refactor(ui): name the sidebar selection by UUID instead of by index - #238
Merged
Merged
Conversation
SidebarSelection::Project and ::Label carried a position in the loaded vectors. A sync that adds, removes or reorders a project slides the selection onto a different one, silently: the sidebar highlights a neighbour and the task list shows its tasks, with nothing to notice the swap. Deleting a project from another client is enough to trigger it. Carry the local UUID instead, which now survives a sync. The index was load-bearing in a few places that get simpler for losing it: SidebarItemType no longer needs original_index, get_sorted_projects no longer carries the original positions alongside the sorted projects, and the data load looks up nothing at all since it already holds the UUID it needs to query. A selection can now be checked, so a reload whose project or label is gone falls back to Today rather than rendering an empty view the sidebar cannot highlight.
romaintb
force-pushed
the
refactor/sidebar-selection-by-uuid
branch
from
September 5, 2026 16:00
5471be1 to
58db254
Compare
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.
The sidebar used to remember the selected project or label by its position in the loaded list. Any sync that added, removed or reordered projects silently moved the selection onto a different one: the sidebar highlighted a neighbour and the task list showed its tasks, with nothing noticing the swap. Deleting a project from another client was enough to trigger it. This PR switches the selection to the project's or label's UUID, which survives a sync, and drops the now-useless index bookkeeping threaded through the sidebar. A selection that points at something deleted now falls back to the Today view instead of rendering an empty one.