Skip to content

fix: propagate dynamic session context into SplitPaneRouter#16

Merged
ibastawisi merged 2 commits intotabs-updatesfrom
copilot/sub-pr-15
Mar 8, 2026
Merged

fix: propagate dynamic session context into SplitPaneRouter#16
ibastawisi merged 2 commits intotabs-updatesfrom
copilot/sub-pr-15

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 8, 2026

SplitPaneRouter baked session into the router context at creation time via useState, so session changes (login, logout, refresh) never propagated into split-pane routes, breaking auth-gated behaviour.

Changes

  • SplitPaneRouter.tsx: Initialize the router with a placeholder session ({ data: null, isLoading: true }), then pass all dynamic values — store, queryClient, session, isSplitPane, splitPaneType — via the context prop on <RouterProvider>, matching the pattern already used in App.tsx.
// Before — session frozen at mount time
const [splitRouter] = useState(() =>
  createRouter({
    ...
    context: { store, queryClient, session: { data: session, isLoading: isPending || isRefetching }, ... },
  }),
);
return <RouterProvider router={splitRouter} />;

// After — session (and other dynamic values) update on every render
const [splitRouter] = useState(() =>
  createRouter({
    ...
    context: { store, queryClient, session: { data: null, isLoading: true }, ... },
  }),
);
return (
  <RouterProvider
    router={splitRouter}
    context={{ store, queryClient, session: { data: session, isLoading: isPending || isRefetching }, isSplitPane: true, splitPaneType: type }}
  />
);

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

The router was created once with session baked in at creation time,
so session/isLoading changes never propagated into split-pane routes.

Mirror the App.tsx pattern: initialize the router with placeholder
session values, then pass the live session and all other context via
the `context` prop on <RouterProvider> so every render picks up the
latest values.

Co-authored-by: ibastawisi <13211445+ibastawisi@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on split view pull request fix: propagate dynamic session context into SplitPaneRouter Mar 8, 2026
@ibastawisi ibastawisi marked this pull request as ready for review March 8, 2026 07:07
@ibastawisi ibastawisi merged commit 73177df into tabs-updates Mar 8, 2026
ibastawisi added a commit that referenced this pull request Mar 8, 2026
* update editor package

* feat: implement split pane layout with tab management

* refactor: centralize URL detection logic for drag-and-drop functionality

- Introduced `hasUrlInDataTransfer` utility function to streamline URL detection across `PaneContent`, `useUrlDropOnPaneContent`, and `useUrlDropOnTabBar` components.
- Updated drag event handlers to utilize the new utility for improved readability and maintainability.

* fix: propagate dynamic session context into SplitPaneRouter (#16)

* Initial plan

* fix: pass dynamic context to SplitPaneRouter's RouterProvider

The router was created once with session baked in at creation time,
so session/isLoading changes never propagated into split-pane routes.

Mirror the App.tsx pattern: initialize the router with placeholder
session values, then pass the live session and all other context via
the `context` prop on <RouterProvider> so every render picks up the
latest values.

Co-authored-by: ibastawisi <13211445+ibastawisi@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ibastawisi <13211445+ibastawisi@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ibastawisi <13211445+ibastawisi@users.noreply.github.com>
@HunterXNB HunterXNB deleted the copilot/sub-pr-15 branch April 16, 2026 17:56
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.

2 participants