fix(dashboard): bypass Rive in folder create/subfolder dialogs#1888
Open
alexis-morain wants to merge 1 commit into
Open
fix(dashboard): bypass Rive in folder create/subfolder dialogs#1888alexis-morain wants to merge 1 commit into
alexis-morain wants to merge 1 commit into
Conversation
The NewFolderDialog and SubfolderDialog render four sibling components (NormalFolder / BlueFolder / RedFolder / YellowFolder) that each call useRive with the same riveFile retrieved from a parent useRiveFile call. Under React 19 / Next 16, this triggers a race between the four useRive inits when the dialog mounts: the runtime ends up reading isPlaying / stateMachines on an undefined Rive instance, throws an Uncaught TypeError inside setupRiveListeners, and bounces between two internal chunks in an infinite up/ud recursion that takes down the page. Replace the four Rive components with a single FontAwesome faFolder icon tinted per color choice. The visual remains four labelled, selectable swatches; only the hover open/close animation is dropped. The folder cards on the dashboard (Folder.tsx) keep their Rive runtime because each card owns its own useRive call and never shares a riveFile, so they don't hit the race. Repro: dashboard / caps -> click "New Folder" on Next 16 + React 19 + @rive-app/react-canvas@^4.18.7 -> dialog crashes, page becomes blank. After the patch the dialog opens reliably and folder creation works unchanged.
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 free
to 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.
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
Fixes a page-crashing race condition in the folder creation dialogs caused by four sibling
useRivecalls sharing a singleriveFileinstance on React 19 / Next 16. The Rive components and their shared file loader are removed from bothNewFolderDialogandSubfolderDialog, replaced with staticFontAwesomeIconswatches tinted per colour choice.useRiveFile, all four*FolderRive components, and thefolderRefsimperative animation handles from both dialogs; hover open/close animations are intentionally dropped as a known trade-off.FontAwesomeIcon faFoldercoloured via inline style, preserving the four selectable colour options and the existing selection/disabled-state logic unchanged.Folder.tsxcards are unaffected as each owns its ownuseRivecall and does not share ariveFile.Confidence Score: 4/5
Safe to merge — removes the crash path with a minimal, well-scoped change; the only findings are cosmetic redundancies in the icon colour props.
The change is a targeted removal of Rive from two dialog components, fixing a hard crash. Core folder-creation logic (RPC call, form state, error handling) is untouched. The redundant
color/style.colordual-specification in both files is cosmetic and carries no functional risk.No files require special attention beyond the minor icon-prop redundancy already flagged.
Important Files Changed
colorprop andstyle.colorare set on the icon, and size is expressed as inline style strings instead of Tailwind utilities.Comments Outside Diff (2)
apps/web/app/(org)/dashboard/caps/components/NewFolderDialog.tsx, line 105-117 (link)colorprop onFontAwesomeIconandstyle={{ color: option.color }}both set the same CSS colour — thecolorprop maps to the SVGcolorattribute (inherited ascurrentColor), while the inline style does the same via CSS. Either one alone is sufficient; the duplicate is redundant. Same pattern appears inSubfolderDialog.tsx.Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
apps/web/app/(org)/dashboard/folder/[id]/components/SubfolderDialog.tsx, line 110-122 (link)NewFolderDialog: thecolorprop andstyle={{ color: option.color }}both control the icon colour; drop one.Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix(dashboard): bypass Rive in folder cr..." | Re-trigger Greptile