Fix DashWrapper hydration cache eviction guard on latest-dash#31
Fix DashWrapper hydration cache eviction guard on latest-dash#31chgiesse wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5ffc4e2dc7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| useEffect(() => { | ||
| const cache = hydrationCache.current; | ||
| if (_newRender) { | ||
| newRender.current = true; | ||
| renderH = 0; |
There was a problem hiding this comment.
Set new-render flag before hydration cache lookup
_newRender is now processed in useEffect, but the render path reads newRender.current before effects run (for example, the cache reuse branch guarded by if (!newRender.current)). When a parent sends _newRender to force a redraw while renderH is unchanged, this render can still return cached hydration, and because mutating a ref in the effect does not schedule another render, the forced redraw may be skipped entirely.
Useful? React with 👍 / 👎.
Motivation
Description
dash/dash-renderer/src/wrapper/DashWrapper.tsxwith a simple LRU eviction, persistentmemoizedKeys,pathKeymemoization, and targeted invalidation on forced renders.dash/dash-renderer/src/reducers/reducer.jsto storeentriesand anindexmapping so lookups for affected subpaths are O(1) instead of scanning the whole map.dash/dash-renderer/src/wrapper/selectors.tsto consume the newlayoutHashesshape and limit checks to relevant indexed paths only.DashWrapperto avoid callingMap.deletewith an undefined key, which fixed the TypeScript compile error surfaced during the test build.Testing
npm run private::lint.renderer, which completed successfully.cd dash/dash-renderer && npm test -- --runInBand, and the webpack/TypeScript build phase completed (TypeScript error resolved); the Karma browser tests could not execute in this environment because no Chrome binary was available (Please, set "CHROME_BIN" env variable).Codex Task