Skip to content

fix(canvas-table): unmount cell-editor React root on end - #2076

Merged
openai0229 merged 2 commits into
OtterMind:mainfrom
Aias00:fix/2070-canvastable-root-unmount
Jul 24, 2026
Merged

openai0229 merged 2 commits into
OtterMind:mainfrom
Aias00:fix/2070-canvastable-root-unmount

Conversation

@Aias00

@Aias00 Aias00 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Related issue

Closes #2070

Summary

In InputIEditor, createElement called ReactDOM.createRoot(inputContainer).render(...) inline and discarded the root reference. onEnd only detached the DOM node (removeChild) — the React fiber tree, state, effects, and handlers inside the rendered component were never torn down, leaking on every cell-edit open/close cycle. Now the root is stored on the instance (this.root) and unmount()ed in onEnd (and this.root nulled). Applied at both createElement sites: the base InputEditor and DateEditor.createElement (the date editor inherits the base onEnd, and createElement is only invoked when inputContainer is null, so there is no double-create that would orphan a prior root).

Affected surfaces

  • Frontend / Web
  • Backend / API / Storage
  • Database plugin / Driver
  • JCEF / Desktop packaging
  • CI / Build / Release
  • Documentation only

Verification

  • Commands and results:
    • npx tsc --noEmit -p chat2db-community-client/tsconfig.json — no errors for InputIEditor/index.tsx.
    • npx eslint src/blocks/CanvasTable/editor/InputIEditor/index.tsx — no errors.
  • Manual verification: On onEnd, this.root?.unmount() is now called (tearing down the React tree), and this.root is nulled. createElement is guarded by if (!this.inputContainer) so it is not called twice without an intervening onEnd.
  • UI evidence: N/A

Risk and compatibility

  • Public API or stored data: N/A.
  • Database or driver compatibility: N/A.
  • Network, privacy, or security: N/A.
  • Community / Local / Pro boundary: N/A.
  • Backward compatibility: Only adds cleanup on onEnd; edit/create behavior unchanged.

Reviewer map

  • Start here: blocks/CanvasTable/editor/InputIEditor/index.tsx — new root field on InputEditor; both createElement sites store this.root = ReactDOM.createRoot(...) then this.root.render(...); onEnd calls this.root?.unmount() and nulls it.
  • Failure condition: React roots still leak across cell-edit open/close.
  • Rollback or disable path: Revert this single commit.

Contributor declaration

  • I linked the Issue that defines this change.
  • I tested the affected behavior and reported the actual results above.
  • I did not include credentials, private data, or generated build output.
  • I disclosed substantial AI assistance below, or this PR contains no substantial AI-generated code.

AI assistance: The fix, verification, and PR description were produced with Claude Code assistance.

createElement called ReactDOM.createRoot(...).render(...) and discarded
the root; onEnd only removed the DOM node, so the React fiber tree leaked
on every cell-edit open/close. Store the root on the instance and unmount
it in onEnd (both InputEditor and DateEditor createElement sites).

Fixes OtterMind#2070

Co-Authored-By: Claude <noreply@anthropic.com>
@Aias00
Aias00 requested a review from openai0229 as a code owner July 24, 2026 16:22
Copilot AI review requested due to automatic review settings July 24, 2026 16:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@openai0229 openai0229 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the React root ownership and unmount lifecycle across the canvas table editors. No blocking findings; LGTM.

@openai0229
openai0229 merged commit 546347b into OtterMind:main Jul 24, 2026
15 of 16 checks passed
@openai0229 openai0229 moved this from In Review to Done in Chat2DB Community Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

CanvasTable cell editors create React roots that are never unmounted

3 participants