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
Maybe at least for $post we could let hal-json-vuex handle this automatically.
Use case:
letmaterialItems=this.api.get().materialItems({contentNodeId: this.contentNode.id})letnewItemData={article: "Tent"}materialItems.$postEager(newItemData)// at this point, materialItems already contains the new item with a temporary uri (simple hash)// including a flag, e.g. item._meta.isPersisted = false (or similary)materialItems.items[materialItems.length-1]._meta.self// --> 5ffd3cb97f651a73502429df51c439cdmaterialItems.items[materialItems.length-1]._meta.isPersisted// --> falsematerialItems.items[materialItems.length-1]._meta.isSaving// --> truematerialItems.items[materialItems.length-1].article// --> Tent
If the network request comes back successfully, the item is updated with the correct uri (of course only in the list above). Otherwise, the temporary entity is removed from the store.
Alternative: temporary key is only used internally and not exposed via _meta.self?
Mutate Store without any server-request.
Allows optimistic updates on clientside
The text was updated successfully, but these errors were encountered: