Replies: 1 comment 2 replies
-
Funny thing, that actually does basically work :) Our messagesAdapter.updateOne(state, {id: oldId, changes: {id: newId}}) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
We're building a direct messaging UI, and would like to optimistically add newly sent messages, but there's a challenge in that the message does not have an ID yet.
We use crypto.randomUUID to generate an ID and assign it as a
clientId
, which we may use to refer to the message for updating it once successfully created on the server.We thought about using
selectId
to reference either property:But I fear that this could get messy.
When we have the message updated with the real ID, I think we would first need to remove the old one, since they will have different IDs indexed in the entity adapter.
Should this work? Are there any other suggested approaches?
It would be nice if you could do the following to update an entity with a new id and re-index the entity adapter.
Beta Was this translation helpful? Give feedback.
All reactions