Tiger šŸ…
Tiger šŸ…ā€¢7mo ago

doing a thread

but why does it always return undefined when im getting the thing all args etc. are there
6 Replies
Tiger šŸ…
Tiger šŸ…OPā€¢7mo ago
thread here i guess
const existingThing = localStore.getQuery(
api.things.getUserThing,
{
thingId: args.thingId,
userId: currentUser._id,
}
)
const existingThing = localStore.getQuery(
api.things.getUserThing,
{
thingId: args.thingId,
userId: currentUser._id,
}
)
this always gives me undefined existing thing doesn't exist do i need to set something else up for it to fully work ive not figured it out yet gonna come back later today help would be immensly appreciated bc i really do need this it'd be great to have it for the mvp ah ok it works i had the wrong thingId šŸ˜… jeez, working with a cms gets tricky ok seems like optimistic ui, i need something that can handle multiple ones quickly so im going with some sort of local first approach i think ive an idea in mind
erquhart
erquhartā€¢7mo ago
Convex optimistic updates are pretty great. Did you get it going? I think it is similar to react query if i remember correctly - you're updating the results of specific queries.
Tiger šŸ…
Tiger šŸ…OPā€¢7mo ago
i got it going thanks for following up @erquhart but i think i need something that can handle multiple actions at once i think im gonna use local storage for the part where i need this interactivity
erquhart
erquhartā€¢7mo ago
Convex optimistic updates can handle multiple actions at once, you can use getQuery/setQuery on as many queries as you like in a single update
Tiger šŸ…
Tiger šŸ…OPā€¢7mo ago
gotcha will take another look into it later not sure why things didnt go as expected maybe bc im calling .then on the mutation and proceeding code inside the then block happens only if write to db is done?
erquhart
erquhartā€¢7mo ago
Yep exactly I mean, the optimistic update would synchronously update queries regardless of what you're running after the mutation promise resolves Can you paste some code here so I can see what you're doing

Did you find this page helpful?