Skip to content

fix: fix invalidation misses on members-related reads#171

Merged
achou11 merged 1 commit intomainfrom
ac/fix-members-query-invalidation
Apr 2, 2026
Merged

fix: fix invalidation misses on members-related reads#171
achou11 merged 1 commit intomainfrom
ac/fix-members-query-invalidation

Conversation

@achou11
Copy link
Copy Markdown
Member

@achou11 achou11 commented Apr 2, 2026

Suspecting this is the cause of the issue with removing a remote archive highlighted in digidem/comapeo-mobile#1797.

Prior to this change, all of the write hooks related to the members API invalidate ['@comapeo', 'projects', someProjectId, 'members', { includeLeft: undefined }], which misses the cases where a read hook internally uses a query key where includeLeft is a boolean value e.g. ['@comapeo', 'projects', someProjectId, 'members', { includeLeft: true }] or ['@comapeo', 'projects', someProjectId, 'members', { includeLeft: false }].

The proposed fix is to omit the last key fragment when includeLeft is undefined or unspecified, so that the write hook invalidations match ['@comapeo', 'projects', someProjectId, 'members'], which will cover all members-related reads.

@achou11 achou11 changed the title fix: fix invalidation misses on members-related queries fix: fix invalidation misses on members-related reads Apr 2, 2026
@achou11
Copy link
Copy Markdown
Member Author

achou11 commented Apr 2, 2026

Part of me thinks that it's not even worth including this option as part of the query key since it could potentially lead to other similar issues due to how the query keys for member-specific reads works. Doing so would mean having to silence the relevant eslint rule about query key deps - there's currently only one line where that would need to be done.

There isn't an issue now because none of the existing write hooks specify the includeLeft option in the query key they invalidate. Think it's okay to leave for now, but something to keep an eye on and improve later on.

@achou11 achou11 merged commit 1abfe10 into main Apr 2, 2026
9 checks passed
@achou11 achou11 deleted the ac/fix-members-query-invalidation branch April 2, 2026 21:03
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.

1 participant