-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(react): handle unstable inline selector results in `useAtomSelect…
…or` (#88)
- Loading branch information
Showing
3 changed files
with
242 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
packages/react/test/units/__snapshots__/useAtomSelector.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`useAtomSelector inline selector that returns a different object reference every time only triggers one extra rerender (strict mode off) 1`] = ` | ||
{ | ||
"1": { | ||
"dependencies": Map {}, | ||
"dependents": Map { | ||
"@@selector-unnamed-1" => { | ||
"callback": undefined, | ||
"createdAt": 123456789, | ||
"flags": 0, | ||
"operation": "get", | ||
}, | ||
}, | ||
"isSelector": undefined, | ||
"refCount": 1, | ||
"weight": 1, | ||
}, | ||
"@@selector-unnamed-1": { | ||
"dependencies": Map { | ||
"1" => true, | ||
}, | ||
"dependents": Map { | ||
"Test-:rb:" => { | ||
"callback": [Function], | ||
"createdAt": 123456789, | ||
"flags": 2, | ||
"operation": "useAtomSelector", | ||
}, | ||
}, | ||
"isSelector": true, | ||
"refCount": 1, | ||
"weight": 2, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`useAtomSelector inline selector that returns a different object reference every time only triggers one extra rerender (strict mode off) 2`] = ` | ||
{ | ||
"1": { | ||
"dependencies": Map {}, | ||
"dependents": Map { | ||
"@@selector-unnamed-3" => { | ||
"callback": undefined, | ||
"createdAt": 123456789, | ||
"flags": 0, | ||
"operation": "get", | ||
}, | ||
}, | ||
"isSelector": undefined, | ||
"refCount": 1, | ||
"weight": 1, | ||
}, | ||
"@@selector-unnamed-3": { | ||
"dependencies": Map { | ||
"1" => true, | ||
}, | ||
"dependents": Map { | ||
"Test-:rb:" => { | ||
"callback": [Function], | ||
"createdAt": 123456789, | ||
"flags": 2, | ||
"operation": "useAtomSelector", | ||
}, | ||
}, | ||
"isSelector": true, | ||
"refCount": 1, | ||
"weight": 2, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`useAtomSelector inline selector that returns a different object reference every time only triggers one extra rerender (strict mode on) 1`] = ` | ||
{ | ||
"1": { | ||
"dependencies": Map {}, | ||
"dependents": Map { | ||
"@@selector-unnamed-1" => { | ||
"callback": undefined, | ||
"createdAt": 123456789, | ||
"flags": 0, | ||
"operation": "get", | ||
}, | ||
}, | ||
"isSelector": undefined, | ||
"refCount": 1, | ||
"weight": 1, | ||
}, | ||
"@@selector-unnamed-1": { | ||
"dependencies": Map { | ||
"1" => true, | ||
}, | ||
"dependents": Map { | ||
"Test-:rd:" => { | ||
"callback": [Function], | ||
"createdAt": 123456789, | ||
"flags": 2, | ||
"operation": "useAtomSelector", | ||
}, | ||
}, | ||
"isSelector": true, | ||
"refCount": 1, | ||
"weight": 2, | ||
}, | ||
} | ||
`; | ||
|
||
exports[`useAtomSelector inline selector that returns a different object reference every time only triggers one extra rerender (strict mode on) 2`] = ` | ||
{ | ||
"1": { | ||
"dependencies": Map {}, | ||
"dependents": Map { | ||
"@@selector-unnamed-3" => { | ||
"callback": undefined, | ||
"createdAt": 123456789, | ||
"flags": 0, | ||
"operation": "get", | ||
}, | ||
}, | ||
"isSelector": undefined, | ||
"refCount": 1, | ||
"weight": 1, | ||
}, | ||
"@@selector-unnamed-3": { | ||
"dependencies": Map { | ||
"1" => true, | ||
}, | ||
"dependents": Map { | ||
"Test-:rd:" => { | ||
"callback": [Function], | ||
"createdAt": 123456789, | ||
"flags": 2, | ||
"operation": "useAtomSelector", | ||
}, | ||
}, | ||
"isSelector": true, | ||
"refCount": 1, | ||
"weight": 2, | ||
}, | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters