fix: avoid redundant table cell content renders - #10657
Open
AkashNemade16 wants to merge 2 commits into
Open
AkashNemade16 wants to merge 2 commits into
AkashNemade16 wants to merge 2 commits into
Conversation
Keep unchanged cell render values and row button context stable when table focus moves to a dialog. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #8890
Opening a dialog from a cell reruns render functions in otherwise unchanged cells, rebuilding nested content such as tabs. Memoize the cell render values and row
ButtonContext, and keep the empty expand-button props stable for non-tree rows.This skips unchanged cell content and button updates, not table state updates. Focus and selection behavior are unchanged; Cell hooks and DOM rendering still run.
With three stable rows, opening a per-cell/shared dialog drops render-prop calls across six unrelated cells from 18/36 to zero in StrictMode. The regressions cover both setups, repeated mouse/keyboard opening and closing, and focus restoration.
GitHub Copilot assisted with implementation and validation.
✅ Pull Request Checklist:
📝 Test Instructions:
Recorded on
fccdedafewith Node 24.14.1, before the subsequentmainmerge:yarn test --maxWorkers=2 --verbose=false: 8,288 tests and 262 snapshots passed; 16 tests skipped. Non-fatal worker teardown warning.yarn test:ssr --verbose=false: all 60 suites and 74 tests passed.yarn lint: passed.Full browser validation remains incomplete. Firefox fails to launch on this macOS host with a sandbox-extension permission error, also reproduced in standalone Playwright before loading repository code. A later Chromium/WebKit run reported four WebKit Chat scroll/loading failures and stalled; these have not been established as pre-existing failures. The 14 TableView, Modal, Dialog, and Tabs cases passed serially on Chromium and WebKit.
For manual review, use TableExample: open a cell's Delete dialog, close with Escape, and reopen with Enter. Check focus returns to the trigger and arrow navigation still works.