Skip to content

fix(ui): wrap fork dialog with PlatformProvider context#18290

Open
Protocol-zero-0 wants to merge 1 commit intoanomalyco:devfrom
Protocol-zero-0:fix/fork-dialog-platform-context
Open

fix(ui): wrap fork dialog with PlatformProvider context#18290
Protocol-zero-0 wants to merge 1 commit intoanomalyco:devfrom
Protocol-zero-0:fix/fork-dialog-platform-context

Conversation

@Protocol-zero-0
Copy link

Issue for this PR

Closes #18250

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Clicking the Fork button crashes with Platform context must be used within a context provider because dialog.show() uses createRoot() 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's onSelect handler, 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?

  • Confirmed dialog.show() uses createRoot() which creates an isolated context
  • Verified PlatformProvider / usePlatform follow the createSimpleContext pattern
  • Change is minimal (8 lines) and follows existing patterns in the codebase

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Made with Cursor

Copilot AI review requested due to automatic review settings March 19, 2026 21:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 usePlatform and capture the current platform value in useSessionCommands.
  • Wrap DialogFork with PlatformProvider inside the session.fork command’s onSelect handler.

💡 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>
)),
Copy link

Copilot AI Mar 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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.

[DESKTOP/WebUI] Forking not possible

2 participants