Skip to content

Commit

Permalink
Remove cache for wrapping selector
Browse files Browse the repository at this point in the history
Summary:
- Wrapping selector does not need to cache because the selector being wrapped has caching options
- Related to facebookexperimental#1840

Reviewed By: drarmstr

Differential Revision: D36956571

fbshipit-source-id: 2709b8603f94158f6a7843e743d1311ff569685d
  • Loading branch information
Nahee Kwak authored and facebook-github-bot committed Jun 7, 2022
1 parent 92161e6 commit b806bb5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/recoil/recoil_values/Recoil_atom.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
* @flow strict-local
* @format
*/

'use strict';

import type {Loadable, LoadingLoadableType} from '../adt/Recoil_Loadable';
Expand Down Expand Up @@ -667,6 +668,12 @@ function atomWithFallback<T>(
return baseValue instanceof DefaultValue ? options.default : baseValue;
},
set: ({set}, newValue) => set(base, newValue),
// This selector does not need to cache as it is a wrapper selector
// and the selector within the wrapper selector will have a cache
// option by default
cachePolicy_UNSTABLE: {
eviction: 'most-recent',
},
dangerouslyAllowMutability: options.dangerouslyAllowMutability,
});
setConfigDeletionHandler(sel.key, getConfigDeletionHandler(options.key));
Expand Down

0 comments on commit b806bb5

Please sign in to comment.