5 Replies
I was returning a Set
hey @magicseth, I see the issue -- it's a misclassified error on our side + us being a bit too strict. we'll get this fixed shortly.
the error is "Duplicate value <redacted> in set", where the framework is refusing to serialize the returned set since it has duplicate values. we'll change this on our side to be more permissive (and toss away duplicates), but in the meantime you can get unblocked by filtering out the duplicate IDs from the return value.
one slight change that might make this easier is to use
id.toString()
to turn the IDs into strings before putting them in the set: this way JS's set will properly deduplicate them.That’s what I ended up doing :/)
the fact that ids are objects has been a perennial issue and we're planning to switch these over to pure strings to simplify situations like these
With 0.17.0 IDs are now strings and can be used in sets safely - also as keys in Objects (though if you store that object in Convex we might barf if it starts with a number) - so using a Map is best for that usecase still
With 0.18.0 we deprecated
Set
btw - you should change it to an array with [...mySet]
or Array.from(mySet)