fix(ui): wrap fork dialog with PlatformProvider context#18290
Open
Protocol-zero-0 wants to merge 1 commit intoanomalyco:devfrom
Open
fix(ui): wrap fork dialog with PlatformProvider context#18290Protocol-zero-0 wants to merge 1 commit intoanomalyco:devfrom
Protocol-zero-0 wants to merge 1 commit intoanomalyco:devfrom
Conversation
Closes anomalyco#18250 Made-with: Cursor
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a crash when invoking the “Fork” session command by ensuring the fork dialog is rendered with the required Platform context, even when dialog.show() mounts content in an isolated Solid root.
Changes:
- Import
usePlatformand capture the current platform value inuseSessionCommands. - Wrap
DialogForkwithPlatformProviderinside thesession.forkcommand’sonSelecthandler.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+492
to
+497
| onSelect: () => | ||
| dialog.show(() => ( | ||
| <PlatformProvider value={platform}> | ||
| <DialogFork /> | ||
| </PlatformProvider> | ||
| )), |
There was a problem hiding this comment.
There’s currently no e2e coverage for the session.fork slash command / fork dialog path (unlike undo/redo/share). Consider adding a Playwright spec that opens the slash palette, selects session.fork, and asserts the dialog renders (and ideally that selecting an item navigates to the forked session) to prevent regressions of this context-related crash.
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.
Issue for this PR
Closes #18250
Type of change
What does this PR do?
Clicking the Fork button crashes with
Platform context must be used within a context providerbecausedialog.show()usescreateRoot()to render the dialog, which creates a new SolidJS root that doesn't inherit parent context providers.The fix wraps
<DialogFork />with<PlatformProvider>in the fork command'sonSelecthandler, passing the current platform value from the parent scope. This is the same pattern used elsewhere in the codebase when rendering components in isolated roots.How did you verify your code works?
dialog.show()usescreateRoot()which creates an isolated contextPlatformProvider/usePlatformfollow thecreateSimpleContextpatternChecklist
Made with Cursor