feat(react): add referentially-stable snapshot and selector caches
useSyncExternalStore requires getSnapshot to return an identical reference when unchanged; @wrnexus/store's readonlySnapshot returns a fresh clone per call. The cache lives here rather than in the store package so existing consumers are untouched. createSelectorCache takes an optional equality function: the Object.is default can never stabilize a selector that allocates, which is the usual source of infinite re-renders. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "@wrnexus/react",
|
||||
"version": "0.8.8",
|
||||
"type": "module",
|
||||
"main": "src/index.ts",
|
||||
"exports": {
|
||||
".": "./src/index.ts",
|
||||
"./runtime": "./src/runtime-source.ts"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"react": { "optional": true },
|
||||
"react-dom": { "optional": true }
|
||||
},
|
||||
"dependencies": {
|
||||
"@wrnexus/store": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "^1.3.14",
|
||||
"typescript": "^6.0.3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user