export function generateTempId(): number { return -Math.floor(Math.random() * 1000000) + 1}
export function generateTempId(): number { return -Math.floor(Math.random() * 1000000) + 1}
which I use when I insert new objects into my electric collections, even though the IDs end up being autogenerated on the DB. I sometimes see a little flicker in the UI as the tx is confirmed and the "new" ID (presumably) comes in. I also sometimes have issues where I try to delete an object and get a 404 on my backend because it's trying to delete something with a temporary (negative) ID. I think I just don't quite understand how the temp ID being replaced happens and how that affects react's behavior. If anyone has any light to shed on it I'd appreciate it!