Uh oh!
There was an error while loading. Please reload this page.
fix(plugin-detail): fix React #300 crash on master-detail drill-in (hoist DetailSection early return below hooks) - #2310
Merged
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
Uh oh!
There was an error while loading. Please reload this page.
…hooks DetailSection had an early `return null` (all-empty section, user hasn't revealed empties) placed BEFORE the virtual-scroll `useEffect`. When the same reconciled fiber rendered all-empty on one pass (N hooks, effect skipped) and populated on the next (N+1 hooks, effect runs), the hook count changed between renders and React threw error #300 ("rendered more hooks than during the previous render"). This is the master-detail drill-in crash: navigating from an account detail into a child project detail reuses the RecordDetailView / DetailSection fiber, and the sections flip from empty to populated — reliably tripping the mismatch. The orange error boundary appeared and a refresh bounced the user away. Fix: move the all-empty guard to AFTER every hook (including the useEffect) so the hook count is invariant to field/data/visibleCount. No behavior change for the render output. Verified in the showcase console: Accounts -> Northwind detail -> Projects tab -> Website Relaunch drill-in now renders with no crash; back-nav to the account and inline edit + validation + save all work.
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 freeto 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.
Problem
Drilling from a master record's related sub-table into a child record crashed with a minified React error #300 ("rendered more hooks than during the previous render"). The record detail page showed the orange error boundary, and refreshing bounced the user away.
Repro (showcase): Accounts list → open Northwind detail → Projects tab → click a project row → the child project detail page crashes.
Root cause
DetailSectionhad its all-empty early return placed before a hook:When the same reconciled fiber rendered all-empty on one pass (early return → effect skipped → N hooks) and populated on the next (no early return → effect runs → N+1 hooks), the hook count changed between renders — the classic Rules-of-Hooks violation React reports as #300.
The master-detail drill-in reuses the
RecordDetailView/DetailSectionfiber (onlyobjectName/recordIdchange via the router), and the sections flip from empty to populated, so it trips reliably.Fix
Move the all-empty guard to run after every hook (including the
useEffect), so the hook count is invariant to field/data/visibleCount. Render output is unchanged.Verification (showcase console)
Fixes the master-detail browse/edit/return flow reported as broken.