fix(dashboard): bypass Rive in folder create/subfolder dialogs#1888
Conversation
cb149c9 to
75e6581
Compare
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
The New Folder and New Subfolder dialogs share a single riveFile (from
useRiveFile) across four sibling color components. With React 19 concurrent
rendering this triggers a race in @rive-app/react-canvas during state-machine
init, crashing the dialog with an infinite up/ud recursion
("Cannot read properties of undefined (reading 'isPlaying'/'stateMachines')").
Replace the Rive folder icons with colored FontAwesome faFolder icons in both
dialogs. The public collection field and folder creation logic are untouched.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
75e6581 to
42113be
Compare
|
Friendly nudge on this one, @richiemcilroy. It's a self-host crash fix (folder create/subfolder dialogs hard-crash the page on React 19 / Next 16 due to four sibling |
|
hey @greptileai please review the PR |
|
Thanks for this @alexis-morain - taking a look! |
Summary
NewFolderDialogandSubfolderDialogrender four sibling Rive components (NormalFolder/BlueFolder/RedFolder/YellowFolder), each callinguseRivewith the sameriveFilereturned by a parentuseRiveFile. On Next 16 + React 19 +@rive-app/react-canvas@^4.18.7this triggers a race between the fouruseRiveinits when the dialog mounts — the runtime ends up readingisPlaying/stateMachineson an undefined Rive instance, throws insidesetupRiveListeners, and the React reconciler bounces between two chunks in an infiniteup/udrecursion that takes down the whole page.Repro
iv → up → ud → up → ud …stack.Fix
Replace the four sibling Rive components in the two creation dialogs with a single
FontAwesomeIcon(faFolder) tinted per colour choice. The dialog still shows four labelled, selectable swatches; only the hover open/close animation is dropped.Folder cards on the dashboard (
Folder.tsx) keep their Rive runtime because each card owns its ownuseRivecall and never shares ariveFile— that path doesn't hit the race.Test plan
New Folder→ dialog renders, four colour swatches visible.New Subfolder.Notes
This is a workaround targeting the race, not an upstream Rive fix. A proper fix probably belongs in
@rive-app/react-canvas(init sequencing when a sharedriveFileis consumed by multipleuseRivehooks). Happy to revert if a newer rive-react release resolves it.Greptile Summary
This PR fixes a crash in the New Folder and New Subfolder dialogs caused by a race condition when four sibling Rive components each called
useRivewith the same sharedriveFileinstance under React 19 / Next 16, ultimately triggering an infinite reconciler loop. The fix replaces the animated Rive swatches with staticFontAwesomeIcon(faFolder) icons tinted per colour option, preserving all functional behaviour (colour selection, create mutation, form reset) while sidestepping the upstream@rive-app/react-canvasrace entirely.useRiveFile, the four Rive sub-components,folderRefs, andonMouseEnter/onMouseLeavehandlers are removed;FolderOptionsgains acolorhex string and renders aFontAwesomeIconin their place.Folder.tsx), which each own an independentuseRivecall and do not share ariveFile.Confidence Score: 5/5
Straightforward removal of a crashing code path; all functional dialog behaviour is preserved.
The change is a targeted deletion of the Rive initialisation code in two symmetrical dialog components. The colour-selection state machine, create mutation, and dialog reset logic are unmodified. No new dependencies are introduced, and the FontAwesomeIcon rendering path has no side-effects that could introduce regressions.
No files require special attention.
Important Files Changed
Reviews (2): Last reviewed commit: "fix(dashboard): bypass Rive in folder cr..." | Re-trigger Greptile