Skip to content

Conversation

@stefanorumi7
Copy link
Contributor

Adds a new delete policy that removes records from local storage only, without hitting the remote API. Useful when you've changed data remotely through another mechanism and want to clean up local cache so the next query will sync fresh data.

@richard457
Copy link
Contributor

Wao @stefanorumi7 I was looking for this and thanks for the PR, hope it will be merged.

@stefanorumi7
Copy link
Contributor Author

Added also localOnly at OfflineFirstUpsertPolicy.

Problem scenario

  1. I invoke an RCP function in Postgres that I know that it updates a certain property of a specific entity if it succeeds.
  2. As the change is dont inside an RCP function, the Brick local storages are not updated.
  3. Next time my local-first request (alwaysHydrate or awaitRemoteWhenNoneExist) will respond with an outdated entity even though I new that entity needed to be changed on that device.

Solution scenario

  1. I invoke an RCP function in Postgres that I know that it updates a certain property of a specific entity if it succeeds.
  2. I update the local DB using OfflineFirstUpsertPolicy.localOnly with the known change
  3. Any future request to that entity will respond with the updated entity.

It is also more consistant as we are now providing OfflineFirstDeletePolicy.localOnly

Copy link
Collaborator

@tshedor tshedor left a comment

Choose a reason for hiding this comment

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

Thank you for opening a PR @stefanorumi7 . I'd prefer the settings.json to be in a different PR, but it's ok for this one.

@stefanorumi7
Copy link
Contributor Author

Sorry about the multiple changes in same PR, will keep it in mind in the future.

@stefanorumi7 stefanorumi7 requested a review from tshedor November 28, 2025 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants