fix: enhance EditorHost to support dynamic editor swapping and add CSS global shim for tests#1872
Open
paustint wants to merge 1 commit into
Open
fix: enhance EditorHost to support dynamic editor swapping and add CSS global shim for tests#1872paustint wants to merge 1 commit into
paustint wants to merge 1 commit into
Conversation
…S global shim for tests Resolves BetterStack error 4872ea91beff23f2e58079fb4efa963c188810d1c7707a70d133d8d3fc92a1ed?s=2336599
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the data-table cell editor host against mid-edit editor-type changes by rendering the column editor as a real React component (so hooks are owned by the editor’s fiber), and it updates the test environment to support selector escaping in jsdom.
Changes:
- Render
renderEditCellvia<EditCell />(instead of invoking it as a plain function) to avoid React hooks-order crashes when the editor implementation swaps during an edit. - Add a regression test proving editor swapping (hookless → hook-bearing) remounts cleanly and preserves the in-progress draft row.
- Add a minimal
globalThis.CSS.escapeshim in the jsdom test setup to support selector construction.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| libs/ui/src/lib/data-table/grid/editors/EditorHost.tsx | Renders the active editor as a JSX component to prevent hooks-order violations during editor swapping. |
| libs/ui/src/lib/data-table/grid/tests/EditorHost.spec.tsx | Adds a regression test covering mid-edit editor swapping and draft preservation. |
| libs/test-utils/src/test-setup-dom.ts | Polyfills CSS.escape for jsdom so grid/editor selector logic can run in unit tests. |
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.
Resolves BetterStack error 4872ea91beff23f2e58079fb4efa963c188810d1c7707a70d133d8d3fc92a1ed?s=2336599