Hey guys, is there a way to provide an id manually...
# prisma-whats-new
k
Hey guys, is there a way to provide an id manually when creating an object? I want to generate it on the frontend because I want it to stay the same both for the optimistic response and the real response. Is this possible?
m
@kitze doesn’t Apollo automatically replace fake one with the actual one?
k
It does, but when clicking too fast (create/delete multiple things at once) from time to time it complains that it cannot find item with id "blah", I don't know if it's a bug but I wanna see if it will go away if the id stays the same.
m
I think that you cannot set
id
as it is considered purely system field 🤞 Maybe you could add custom field which would keep your custom
id
and change Apollo identifier to your custom field, but that seems way to much work…
What type of data are you using in your schema?
Found an issue for this
👍 1
l
@kitze, in my scenario, I have a vehicle offer that's initially built up over client state, but when it's finally ready to be finalized and sent, the UI needs to make instant decisions and cannot wait for the server's return ID. So I make a clientId UUID and define it as unique on the server.
v
I'm curious to why you want it to stay the same over the optimistic update?