Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support invalidating linked records with any combination of arguments #4750

Open
alex-statsig opened this issue Jul 29, 2024 · 0 comments
Open

Comments

@alex-statsig
Copy link
Contributor

Context

I need to invalidate an edge (linked record, not a connection for now) for all combinations of filters upon the user creating a new instance of the item. For example, the user might create a new "TodoItem" and I want to update/invalidate the edge todos: [TodoItem]. For simple filters like todos(completed: Boolean), it can be easy to just invalidate the affected arguments (ex. only todos(completed: False) and todos(completed: Null) need to be updated). As more filters are added this no longer becomes sustainable, especially when arbitrary user input is added (for example searchString).

Proposed Fix

For fields with complex filters, manually updating the store via updaters/connections is not really feasible. I'd like an API within the updater where I could do root.invalidLinkedRecord("todos") to invalidate all combinations of arguments (perhaps with the ability to target a subset such as completed: True only).

There is a line in the docs about this which says "An easier API alternative to manage multiple connections with multiple filter values is still pending", so it seems like this is a known gap, but at least having some tracking of the issue seems helpful still.

Workarounds

Currently, the only workaround I see is to invalidate the parent object (ex. root.invalidateRecord()), which is dramatically overkill. I also started a discussion in the Discord around this, but it seemed like others ran into similar trouble and didn't have any workaround either.

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

No branches or pull requests

1 participant