Skip to content

fix: key HeroSlackMessage body paragraph by message id to prevent removeChild crash #SUPERLOG - #428

Open
superlog-app[bot] wants to merge 1 commit into
mainfrom
superlog/fix-hero-slack-remove-child
Open

fix: key HeroSlackMessage body paragraph by message id to prevent removeChild crash #SUPERLOG#428
superlog-app[bot] wants to merge 1 commit into
mainfrom
superlog/fix-hero-slack-remove-child

Conversation

@superlog-app

@superlog-app superlog-app Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

The homepage (/) crashes with Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node. every time the animated Slack card in the hero section rotates (every 2.8 s). The BrowserErrorBoundary catches it and renders the error screen, replacing the entire landing page.

Root cause

The HeroSlackMessage component (added in #427) cycles through three message objects via setActiveMessageIndex, triggered by onAnimationIteration on the CSS-animated .landing-slack-shuffle-card div. Each message has a body field — a JSX Fragment created at module initialization time (not at render time) — that mixes raw text nodes with <SlackCode> (<code>) elements.

Because the <p> that renders {message.body} has no key prop, React reconciles its children in place (positional diffing) when the message changes. The homepage is prerendered (SSR via renderToString) and then hydrated client-side with hydrateRoot. Mixed text-node/element fragments can have subtle differences in how adjacent text nodes are split between SSR and CSR, leaving React's internal fiber tree slightly out of sync with the real DOM. When the first animation iteration fires and React tries to remove excess old DOM nodes from the <p>, it calls parentNode.removeChild(node) on a node that is no longer at the expected position, producing the NotFoundError.

Fix

Add key={message.id} to the <p> element. When the key changes, React unmounts and remounts the paragraph entirely rather than attempting incremental child reconciliation, eliminating the stale-reference removeChild call.

// before
<p className="pb-3.5 text-[11.5px] italic ...">
  {message.body}
</p>

// after
<p key={message.id} className="pb-3.5 text-[11.5px] italic ...">
  {message.body}
</p>

All 14 existing Landing.test.ts tests pass.

Incident: c31e760e-d0ec-4e3f-a2b3-2c106c01a7a5


Was this PR helpful? Leave feedback — goes straight to the Superlog team.


Summary by cubic

Fixes a homepage crash when the hero Slack card rotates by preventing a React DOM mismatch. The message paragraph is now keyed by message.id, so it remounts on change and avoids the removeChild error.

Written for commit 5f6a15b. Summary will update on new commits.

Review in cubic

…oveChild crash #SUPERLOG

Delivery-Id: e2342e7d51ab9a66c1fa56101fb7f1ca6ae6a6ac5c5fe70b5f5504aeb1ebe0de
Delivery-Base: main

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Observability review

All clear — no observability concerns found.

All your logs are super.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant