unique index does not throw DuplicateKeyError
Maybe I'm misunderstanding how it should work but I'm trying to handle duplicates on the client to faster feedback.
I have added an index to my collection and it correctly deduplicates the data, however my insert just fails silently now
and when submitting the form:
However this never throws, it just silently deduplicates on insert.
It worked perfectly when I had a duplicate key in the collection, just not for indices
2 Replies
fair-roseOP•5w ago
https://github.com/TanStack/db/blob/7d813be190f983e6dd91e5cbda3c1ff65afa4d79/packages/db/src/collection.ts#L1860C1-L1863C8
that seems to be the case actually, this only throws if the
key
is a duplicateGitHub
db/packages/db/src/collection.ts at 7d813be190f983e6dd91e5cbda3c1ff...
A reactive client store for building super fast apps - TanStack/db
fair-roseOP•5w ago
this workaround works, at least for small collections