rxdb-supabase
rxdb-supabase copied to clipboard
Error: ensureNotFalsy() is falsy in getSingleDocument
Hi
I try to run the example according to the description, but I get an error when creating the replication: ensureNotFalsy() is falsy
The error occurs with the addConnectedStorageToCollection function, namely with getSingleDocument, which returns zero
async function addConnectedStorageToCollection(collection, storageCollectionName, schema) {
var collectionNameWithVersion = _collectionNamePrimary(collection.name, collection.schema.jsonSchema);
var collectionDocId = getPrimaryKeyOfInternalDocument(collectionNameWithVersion, INTERNAL_CONTEXT_COLLECTION);
while (true) {
=>>> var collectionDoc = await getSingleDocument(collection.database.internalStore, collectionDocId);
=>>> var saveData = clone(ensureNotFalsy(collectionDoc));
if (!saveData.data.connectedStorages) {
saveData.data.connectedStorages = [];
}
var alreadyThere = saveData.data.connectedStorages.find((row) => row.collectionName === storageCollectionName && row.schema.version === schema.version);
if (alreadyThere) {
return;
}
This rxdb function has apparently changed, but since version 14.15.1 is used in the project, the changes are not included.
https://github.com/pubkey/rxdb/commit/46f36368b58a9484f00145b85e61e4af21a85f06#diff-96872ef558a49d727431d58ca95d9fc2791e8b1727edfca0fcfdabac159b79c3R52
i just don't understand why this could have worked before? maybe i'm completely wrong
Could you include the code that you're trying to run? Even better of course would be a minimal failing test case :)
Are you saying it's a bug in RxDB? Does the problem go away if you set an explicit RxDB version in your package.json?
Thank you very much for your advice. It was really due to the different versions. if I use the rxdb version 14.15.1 in packing.json, it works!
Are you sure you mean 14.15.1? Because that's the one in the package.json of this project already. If there is a bug that was fixed in a later version, I should probably bump versions and do another release
Is it possible for you to release a version compatible with rxdb@15? There is a feature in 15 that I'd like to use, together with rxdb-supabase.
I can confirm that downgrading to rxdb 14.15.1 works. Supporting v15 would be nice anyway.
Is there going to be V15 support?
Is there going to be V15 support?
I'll try to do a new release this month and clean up some issues and PRs
I have created a gist that updates and fixes a number of things. You can use this TS file directly. I have also created a way to map your keys to your table columns. i.e. camelCase -> underscore_case. I think this also works with JSONB columns.