Skip to content

Fix browser freeze when clicking a component on the Browse page - #1133

Open
bielu wants to merge 1 commit into
clearlydefined:masterfrom
bielu:fix/browse-row-click-freeze
Open

bielu wants to merge 1 commit into
clearlydefined:masterfrom
bielu:fix/browse-row-click-freeze

Conversation

@bielu

@bielu bielu commented Oct 11, 2026

Copy link
Copy Markdown

Fixes #1130

Problem

On the home page (Browse list), clicking any component row freezes the tab. No console error appears, and opening a definition by direct URL works fine.

Cause

PageBrowse replaces this.state in its constructor, which drops the sequence: 0 set by its base class SystemManagedList. The first row click runs incrementSequence(), computing undefined + 1, so sequence becomes NaN.

ComponentList.componentDidUpdate compares this.props.sequence !== prevProps.sequence. That is always true for NaN, so it calls setState on every update and the whole list re-renders forever.

Fix

Spread the inherited state (...this.state) before the Browse-specific fields in the PageBrowse constructor.

Testing

  • Reproduced the freeze on clearlydefined.io and on a local dev build pointed at the production API, and traced the loop to the NaN comparison.
  • With the fix, rows expand and collapse normally on the local build.
  • Added a regression test in src/components/__tests__/PageBrowse.test.js; it passes with the fix and fails without it. Only that test file was run locally, not the full suite.

🤖 Generated with Claude Code

PageBrowse replaced the state initialized by SystemManagedList, dropping
`sequence: 0`. The first row click then computed `undefined + 1`, so
`sequence` became NaN. ComponentList.componentDidUpdate compares
`this.props.sequence !== prevProps.sequence`, which is always true for
NaN, so it kept calling setState and re-rendering the list forever.

Keep the inherited state when PageBrowse sets its own, and add a
regression test.

Fixes clearlydefined#1130

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

❌ Deploy Preview for blissful-goodall-fa23f6 failed.

Name Link
🔨 Latest commit 507f5c9
🔍 Latest deploy log https://app.netlify.com/projects/blissful-goodall-fa23f6/deploys/6acc0ccc947b9f0008ff6b15

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.

Browser crashing on home page after click

1 participant