Skip to content

Conversation

daveycodez
Copy link

This PR addresses the majority of "any" type usage in the rxdb-db-collection adapter as well as fixes for only querying documents where _deleted is false, which fixes issues when using localStorage or other persistent storage mechanisms.

Fixes #630

Replaces generic 'any' types with more specific types such as 'Subscription' and 'Record<string, unknown>' for improved type safety. Removes unnecessary type assertions and updates function signatures and variable declarations accordingly.
Added '_deleted': false to query selectors to ensure only non-deleted documents are included during synchronization. This improves data consistency by excluding soft-deleted records from sync operations.
Copy link

changeset-bot bot commented Oct 10, 2025

⚠️ No Changeset found

Latest commit: 3f2552a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Updated the stripRxdbFields function to use a stricter type for the input parameter and removed unnecessary handling for arrays and nullish values.
Copy link
Collaborator

@samwillis samwillis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @daveycodez

Would it be possible to add a test that validates the delete behaviour?

@daveycodez
Copy link
Author

daveycodez commented Oct 10, 2025

Thanks for this @daveycodez

Would it be possible to add a test that validates the delete behaviour?

Seems like a complex test that would need to run in the web browser and then refresh the page to verify. It requires access to localStorage.

The issue was that it loads the data and skips rxdb query and runs directly on the storage instance which skips rxdb filtering out deleted documents.

Added 'rxjs' with version >=7.8.2 to peerDependencies in package.json to ensure compatibility and proper dependency management.
Copy link

pkg-pr-new bot commented Oct 11, 2025

More templates

@tanstack/angular-db

npm i https://pkg.pr.new/@tanstack/angular-db@667

@tanstack/db

npm i https://pkg.pr.new/@tanstack/db@667

@tanstack/db-ivm

npm i https://pkg.pr.new/@tanstack/db-ivm@667

@tanstack/electric-db-collection

npm i https://pkg.pr.new/@tanstack/electric-db-collection@667

@tanstack/query-db-collection

npm i https://pkg.pr.new/@tanstack/query-db-collection@667

@tanstack/react-db

npm i https://pkg.pr.new/@tanstack/react-db@667

@tanstack/rxdb-db-collection

npm i https://pkg.pr.new/@tanstack/rxdb-db-collection@667

@tanstack/solid-db

npm i https://pkg.pr.new/@tanstack/solid-db@667

@tanstack/svelte-db

npm i https://pkg.pr.new/@tanstack/svelte-db@667

@tanstack/trailbase-db-collection

npm i https://pkg.pr.new/@tanstack/trailbase-db-collection@667

@tanstack/vue-db

npm i https://pkg.pr.new/@tanstack/vue-db@667

commit: 3f2552a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deleting RxDB rows does not persist to localStorage

2 participants