Skip to content

Bug: "insertBefore" NotFoundError when adding a new page #94

Description

@crewletapp

Bug Report

Description

The application crashes with a React DOM reconciliation error whenever a new page is added.

Error Message

NotFoundError: Cannot perform "insertBefore" on "Node": The node to be inserted is not a child of this node.
at ir (https://app.superdesign.dev/static/js/lib-react.ea884da0.js:2:94091)
at ir (https://app.superdesign.dev/static/js/lib-react.ea884da0.js:2:94202)
at ir (https://app.superdesign.dev/static/js/lib-react.ea884da0.js:2:94202)
at iS (https://app.superdesign.dev/static/js/lib-react.ea884da0.js:2:104085)
at iw (https://app.superdesign.dev/static/js/lib-react.ea884da0.js:2:98998)
at ib (https://app.superdesign.dev/static/js/lib-react.ea884da0.js:2:98868)
at iw (https://app.superdesign.dev/static/js/lib-react.ea884da0.js:2:101164)
at ib (https://app.superdesign.dev/static/js/lib-react.ea884da0.js:2:98868)
at iw (https://app.superdesign.dev/static/js/lib-react.ea884da0.js:2:98990)
at ib (https://app.superdesign.dev/static/js/lib-react.ea884da0.js:2:98868)

Steps to Reproduce

  1. Open the application
  2. Add a new page

Expected Behavior

New page is added without errors.

Actual Behavior

Application crashes with the above NotFoundError.

Root Cause (suspected)

This is a React DOM reconciliation conflict. Likely causes:

  1. Unstable/missing key props on page list items — when the list re-renders after a new page is inserted, React miscalculates which DOM nodes to move/insert
  2. Portal target unmounted — if a ReactDOM.createPortal is used in page components and its container gets removed from the DOM during re-render, this exact error fires
  3. External DOM mutation (e.g. browser extension) interfering with React's virtual DOM

Suggested Fix

  • Verify every item in the page list has a stable, unique key prop (not array index)
  • Audit any ReactDOM.createPortal usage tied to page components
  • Check for any third-party scripts modifying the DOM directly

Environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions