You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The child components will expect the client to be available even when not yet ready.
I can suggest the fix below for this issue, that ensures that the child components consuming the client will only be rendered when the client is done loading.
We could alternatively have a change to the scaffolded vue code where the loading and error state from connecting to the client in App.vue is shared with all child components where each child component consuming the client would be expected to handle the state respectively, but I found this fix much simpler, tell me what you think.
hmmmmmmmmmm... this brings up an interesting question -- whose job is it to manage whether the client is connected? @matthme and I decided to solve this by putting an async getClient function on the root context that resolves when the client is connected. Then each child component is responsible for setting its own loading variable and only showing the data when it has a client to talk to.
I'm really attracted to the idea of making it a concern of the root component though. Components not loading? It's cuz you didn't guard against it in the root. Fix it there and you fix it for everything. It simplifies the child components too.
Describe the bug
When I scaffold a Vue-based hApp, any component that tries to get the client from the root component fails.
CreateFoo.vue
pops up an alert when I try to save a record, with the textAllFoos.vue
gives an error message in the component:I suspect this is similar to the race condition that @matthme fixed in #425 .
Expected behavior
Child components should be able to get a Holochain client object that's ready when they need to do client stuff.
System information
Steps to reproduce
Foo
entry type. The entry type should have a global collection.AllFoos.vue
intoui/src/App.vue
and put it in the markup.npm start
Screenshots
The text was updated successfully, but these errors were encountered: