samedi 19 septembre 2020

Related objects not showing even when present in data store

I'm learning Ember (3.21) and am at a loss as to why related items will not show as being attached to their parent model when retrieving from the store. I am having trouble finding answers to this question in Ember Octane, as most similar answers are for older versions and no one seems to be having this issue.

For context, I'm creating a very simple todo list app.

Looking in Ember inspector, my api returns properly and all records are added to the store: lists get successfully

items get successfully

My (JSON) rails api returns the data properly, with each todoList object containing the list of relationships in the data property and the full object in the relationships property. in TodoListsRoute:

model() {
    return this.store.findAll('todo-list');
}

In todo-lists.hbs:

    
       <TodoList @todoList= @delete=/>
    
    

in todo-list.hbs (the custom component referred to as <Todolist ...>), each todo list title/description displays fine. My issue is that I cannot get any of the todo items underneath the lists to display. Here's the code where i try to do that:

<div class="todo-list-items">
    <div>
        <button class="delete-button" ><i class="fas fa-trash"></i></button>
    </div>
    
    <div>
        
    </div>
    
</div>

Logging this.args.todoList.todoItems into the console returns a full class, but it doesnt seem to contain any actual todoItem data.

Any help greatly appreciated.




Aucun commentaire:

Enregistrer un commentaire