Entity expiry
#3627
Replies: 1 comment 5 replies
-
Personally I am less of a fan of the expiry way of thinking and a fan of client controlled nullability to achieve this, this would behave similarly to Schema awareness only you tell the cache what can be nullable. The thing with expiry is that it's harder to customise as there's also a lot of data that you don't want to show when it's expired/stale. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
cache.invalidate
removes an entitiy completely, resulting in the query returning null for nullable fields with schema awareness otherwise suspending (if enabled).This causes the UI to awkwardly suspend when it should show the old data until the query refetches
Desired behaviour
A expire function that refetches any query that references the expired entities with the
cache-and-network
request policy.This would refresh the data without completely discarding the old data.
Potential exchange
As a novice to the internal details of URQL, it seems a exchange would be able to accomplish this and would look somewhat like the refocus exchange.
cache-first
orcache-only
expire
is called, find expired queries - those that references expired entitiescache-and-network
Please let me know if I'm thinking about this problem wrong, or have any suggestions regarding the implementation or otherwise achieving the desired behaviour
Beta Was this translation helpful? Give feedback.
All reactions