refactor(dashboard): immutable state updates, drag-drop hook, and granular contexts#497
Merged
Merged
Conversation
aldbr
force-pushed
the
split/3-dashboard-contexts
branch
5 times, most recently
from
July 14, 2026 16:34
141cc2f to
8698cbc
Compare
ryuwd
reviewed
Jul 14, 2026
Contributor
There was a problem hiding this comment.
I see mainly small things or things that can be deferred to issues for later, otherwise LGTM
P.S. some things I discussed with an LLM and the LLM explained better than me so I added some of the explanations from there but take with a grain of salt and feel free to defer those to later
aldbr
force-pushed
the
split/3-dashboard-contexts
branch
from
July 15, 2026 06:37
8698cbc to
8e25460
Compare
…nular contexts Split the monolithic ApplicationsContext tuple into three purpose-built contexts (AppListContext, DashboardContext, CurrentAppContext) so components subscribe only to the state they read, and rework the dashboard layout around them: - extract drag-and-drop monitoring into a useDashboardDragDrop hook and the context menu into a DrawerContextMenu component; DashboardDrawer now updates dashboard state immutably (no in-place mutation of groups) - rewrite hooks/application.tsx around the granular contexts (useAppList, useDashboard, useApplicationId, useCurrentApplication) and drop useApplicationTitle/useApplicationType - memoize NavigationProvider and OIDCConfigurationProvider values - ProfileButton loses the dead About entry; ThemeToggleButton, Import/ExportButton, ApplicationDialog and ApplicationSelector are adapted to the new contexts - contexts/index.ts now exports the granular contexts explicitly (ApplicationsContext is gone); Dashboard stories/tests updated
useDashboardDragDrop no longer takes userDashboard or mirrors it in a ref. reorderSections receives the source/destination group titles from the drop event and looks the groups up inside the setUserDashboard functional updater, where React hands it the freshest state. This drops the ref, its sync effect, and the userDashboard parameter, and removes the (practically unreachable) window where a drop could read a stale dashboard between a state commit and the ref update. The destination index is copied into a local so the updater stays pure under StrictMode. Draft addressing review comment C6.1 — kept as its own commit for review. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
aldbr
force-pushed
the
split/3-dashboard-contexts
branch
from
July 15, 2026 07:14
41492a5 to
329cbaf
Compare
ryuwd
approved these changes
Jul 15, 2026
ryuwd
left a comment
Contributor
There was a problem hiding this comment.
LGTM! Thank you for addressing the comments
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.
Part of #494 (stack 3/5). Stacked on #496 — until it merges, review the last commit only (
refactor(dashboard)).Dashboard/drawer refactor and context granularity:
useDashboardDragDrophook (stable-ref pattern, drop targets no longer re-register on every render) and the context menu intoDrawerContextMenu;useAppList,useDashboard,useApplicationId,useCurrentApplication).Note for extension authors:
useApplicationTitle/useApplicationTypeare removed; state restored from storage is now structurally validated before use.🤖 Generated with Claude Code