Skip to content

Fix sidebar state persistence - #826

Open
Creylay wants to merge 6 commits into
developfrom
fix/sidebar-state-persistence
Open

Fix sidebar state persistence#826
Creylay wants to merge 6 commits into
developfrom
fix/sidebar-state-persistence

Conversation

@Creylay

@Creylay Creylay commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes two related bugs in the left sidebar across the Datasets, Models, and Generative modules: (1) datasets/folders were fetched and held independently by the Datasets and Models modules, so changes made in one wouldn't show up in the other without a full remount; (2) sidebar UI state (which session/task groups and which dataset folders were expanded) lived in leaf components that unmount on every route change, so it silently reset to closed/default every time the user navigated away and back. Both are fixed by lifting the shared data into one DatasetsProvider mounted at the app root, mounting ModelsProvider/GenerativeProvider at the root too, and making the group/folder list components controlled so their open/closed state lives in these persisted contexts instead of local component state.


Type of Change

Check all that apply like this [x]:

  • Backend change
  • Frontend change
  • CI / Workflow change
  • Build / Packaging change
  • Bug fix
  • Documentation

Changes (by file)

  • src/contexts/DatasetsContext.jsx (new): shared DatasetsProvider. The single source of truth for datasets/folders (previously duplicated in ModelsContext and DatasetsAndNotebooksContext), plus the new shared openFolderIds map that tracks which named folders are expanded.
  • src/components/models/ModelsContext.jsx: consumes the shared DatasetsProvider instead of calling useDatasets/useFolders directly; re-exposes openFolderIds/setOpenFolderIds; adds persisted openSections state for the sidebar's task-group open/closed map (previously local state in ModelsLeftBar).
  • src/components/custom/contexts/DatasetsAndNotebooksContext.jsx: same migration to the shared DatasetsProvider; re-exposes openFolderIds/setOpenFolderIds.
  • src/components/generative/GenerativeContext.jsx: adds persisted openSections state for the sidebar's session-group open/closed map (previously local state in SessionBar).
  • src/App.jsx: mounts DatasetsProvider > ModelsProvider > GenerativeProvider at the app root, above the router, so their state survives navigation instead of resetting every time /app/models or /app/generative is left and re-entered.
  • src/pages/models/Models.jsx, src/pages/generative/Generative.jsx: no longer wrap their own page-scoped Provider (moved to App.jsx).
  • src/components/threeSectionLayout/GroupedCollapsibleList.jsx: adds an optional controlled mode (openGroups/onOpenGroupsChange), backward-compatible with its existing uncontrolled initialOpenGroups usage.
  • src/components/models/ModelsLeftBar.jsx, src/components/generative/SessionBar.jsx: read/write group open-state through their context instead of local useState, and pass it into GroupedCollapsibleList as a controlled prop; ModelsLeftBar's group-reset effect now merges (preserves already-open groups) instead of wiping all groups closed when a new task category appears, matching SessionBar's existing behavior.
  • src/components/threeSectionLayout/DatasetFolderList.jsx: FolderSection gains an optional controlled open/onToggleOpen mode; the bulk-select "open everything" behavior is now a derived render-time value instead of a write into the persisted folder-open map, so entering bulk-select mode no longer permanently overwrites the user's closed folders.
  • src/components/notebooks/DatasetNotebookLeftBar.jsx: passes the shared openFolderIds/setOpenFolderIds into DatasetFolderList.

Testing (optional)

  • Rename/delete/move a dataset in one module and confirm it's reflected in the other without reloading.
  • Expand a session/task group or a dataset folder, navigate away to another module and back, iit should stay expanded (previously always reset).
  • Enter bulk-select mode ("select items to delete") after closing a folder/group, then exit. The folder/group should go back to closed instead of staying force-opened.

@Creylay Creylay added front Frontend work bug Something isn't working labels Aug 17, 2026
@cristian-tamblay cristian-tamblay added the conflict This PR has merge conflicts label Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working conflict This PR has merge conflicts front Frontend work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants