Anyone have a good solution for
Anyone have a good solution for optimistic updates and having temporary IDs that conflict with the actual convex ID?
For example, I am adding messages to my chat app optimistically and for each message I have a query that takes in that ID to fetch the reactions of the message. Obviously when I optimistically add a message with a fake uuid convex complains since it's querying something that doesn't exist (yet)
Is this something to worry about or fix?
3 Replies
Maybe this is what I'm looking for? https://github.com/shuding/legid
GitHub
GitHub - shuding/legid: A library for generating safe, legit and ra...
A library for generating safe, legit and random URL-compat IDs. - shuding/legid
I.e. generate the ID on the client and use in my optimistic update, use that as my actual message ID on the server when inserting the message?
You should probably skip the query for items that don't have an actual convex id