question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature Request: option to refresh to not recursively refresh all upstream selectors

See original GitHub issue

from the docs https://recoiljs.org/docs/api-reference/core/useRecoilRefresher

It is currently a no-op to “refresh” an atom, it will retain its current state. Selectors will have their caches cleared. Because wrapper selectors are often used as abstractions, refreshing a selector will also recursively refresh the caches of all selectors that it depends on.

However, if those upstream selectors have not changed but is used from the refreshed selector it will once again refresh and refetch (if doing some data fetching). IMO a good solution is an option that we can pass in to refresh to not refresh upstream selectors especially since its also a common use case. the current behavior would cause a cascade of refreshes when a lot of them are unnecessary

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
drarmstrcommented, Mar 17, 2022

Yes, we decided to start conservatively and invalidate all upstream selectors (including all upstream selectors for all possible values of dependencies). This default avoids missing refreshes if queries are performed from upstream selectors or secretly missing refreshes if wrapper selectors are added in abstraction layers, which is a common practice.

We discussed different options for minimizing the set of invalidations, but it hasn’t been a priority, so PRs are welcome. That’s because often when you want this much control over using Recoil as a local cache for remote mutable or changing data it can be better to use an atom with Atom Effects.

0reactions
drarmstrcommented, Aug 10, 2022

No work on this is currently planned, but we do accept PRs. In general I am personally wary of “refresh” and tend to recommend using atoms instead of selectors when users need more explicit control over updating values.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug listing with status RESOLVED with resolution UPSTREAM ...
(feature request)" status:RESOLVED resolution:UPSTREAM severity:enhancement · Bug:36398 - "kppp doesn't connect if 'auth' is set in the /etc/ppp/option" ...
Read more >
Frequently asked questions - Flux CD
General questions. Does Flux have a UI / GUI? The Flux project does not provide a UI of its own, but there are...
Read more >
What's New - Tines
Read about all the latest Tines features and updates.
Read more >
ReleaseNotes02x01 < System < TCCON Wiki
Developers can extend the functionality of Foswiki with plugins. ... After installing this update, you should issue the refresh=all option to drop the ......
Read more >
January 2022 (version 1.64) - Visual Studio Code
Update 1.64.1: The update addresses these security issues. ... feature request, we have added a new layout option called Panel Alignment.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found