You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sidebar project filter: save filters as named views
#39774
I keep switching the sidebar between the same few sets of projects: work repos, everything except personal projects, or just two repos for a focused afternoon. Rebuilding that with Shift+click every time is slow. PRs (#29387) and Issues (#37963) already have saved views. The sidebar project filter doesn't.
Idea
Save filter as view⦠at the top of the project picker whenever the current filter isn't saved. It opens the same name dialog PR and Issue views use.
Saved views are listed at the top of the picker, with a check on the active one. Picking one applies it, and typing its name in the picker search finds it.
Right-click a view (or use its β¦ button or the ContextMenu key) to update it to the current filter, rename it, or delete it.
Views are saved per device, like PR and Issue views. This covers web and desktop. Mobile's filter picks a single project, so it would need multi-select first.
I built this locally and used it with my real project list, and it works well. Below is a prompt that rebuilds it, in case you want it.
Implementation prompt
Add saved views to the sidebar project filter in T3 Code (web and desktop).
Context
- The sidebar project filter is the Combobox passed as `projectScope` to
SidebarThreadHeader in apps/web/src/components/Sidebar.tsx. Its state is
`sidebarProjectScopeKeys` in apps/web/src/uiStateStore.ts. Shift+click
toggles a project (#25284).
- PR and Issue lists already have saved views: apps/web/src/components/SavedViewsMenu.tsx,
packages/client-runtime/src/savedViews.ts and
apps/web/src/components/issue/issueSavedViews.ts. Reuse them.
Build
1. Exclude mode (skip if #37912 has landed, and build on it instead). Persist
`sidebarProjectScopeExclude: boolean` next to the keys in uiStateStore. The
setter becomes `setSidebarProjectScope({ keys, exclude })` and forces exclude
to false when keys are empty. In Sidebar, the listed groups are
`scopeGroups.filter((p) => exclude !== keys.includes(p.projectKey))`;
everything downstream already reads that list. A route reveal that widens
the scope resets both. Picker rows show a check on every listed project, and
Shift+click toggles a key while keeping the mode.
2. Move the storage and name dialog out of SavedViewsMenu into a
`useSavedViews(kind)` hook that returns
{ views, dialog, startSave, startRename, update, remove }. SavedViewsMenu
keeps its behavior on top of it. Add a "project" case to the `list` select
strings: the save-failed toast, the save and rename dialog titles, and the
dialog description.
3. Add a SavedViewsKind for the sidebar: storage key `t3.sidebar.projectViews`,
preferences `{ keys: string[], exclude: boolean }`. Normalize sorts and
dedupes the keys, and matches compares the normalized values.
4. Prepend rows to the picker: one per saved view (bookmark icon, check badge
when it matches the stored scope), then "Save filter as viewβ¦" (only when the
scope is filtered and unsaved) and "Invert selection" (flips exclude and
keeps the menu open with eventDetails.cancel()). Leave the action rows out of
search matches; view rows stay searchable. Render these rows in their own
component under apps/web/src/components/sidebar/.
5. A view row opens a context menu (readLocalApi().contextMenu.show) on
right-click, from a hover "β¦" button, and from ContextMenu or Shift+F10 in the
picker search: "Update to current filter" (only when it differs),
"Rename viewβ¦" and "Delete view".
6. The thread context menu's "Filter by project" counts as active only in
include mode.
Verify
- Unit test toggling a key in exclude mode and matching views regardless of key
order. Extend the uiStateStore restore test with the exclude flag.
- Add one browser test to Sidebar.browser.test.tsx: filter to one project,
invert, save it as a view, switch to All projects, pick the view, and assert
which threads show. Load index.css in that test and mock useServerConfigs,
otherwise a Base UI inert overlay and mocks left by other tests break it.
- Run `vp run i18n:generate`, translate the new keys in every apps/web locale,
then run `vp run i18n:check` and `vp run check:changed`.
- Add a short "Filter by project" section to docs/user/thread-sidebar.md.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I keep switching the sidebar between the same few sets of projects: work repos, everything except personal projects, or just two repos for a focused afternoon. Rebuilding that with Shift+click every time is slow. PRs (#29387) and Issues (#37963) already have saved views. The sidebar project filter doesn't.
Idea
I built this locally and used it with my real project list, and it works well. Below is a prompt that rebuilds it, in case you want it.
Implementation prompt
All reactions