Skip to content

refactor(ui): name the sidebar selection by UUID instead of by index - #238

Merged
romaintb merged 1 commit into
mainfrom
refactor/sidebar-selection-by-uuid
Sep 5, 2026
Merged

romaintb merged 1 commit into
mainfrom
refactor/sidebar-selection-by-uuid

Conversation

@romaintb

@romaintb romaintb commented Sep 5, 2026

Copy link
Copy Markdown
Owner

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.

Base automatically changed from feat/selection-follows-task to main September 5, 2026 16:00
@romaintb romaintb self-assigned this Sep 5, 2026
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
romaintb force-pushed the refactor/sidebar-selection-by-uuid branch from 5471be1 to 58db254 Compare September 5, 2026 16:00
@romaintb
romaintb merged commit 0ef78e7 into main Sep 5, 2026
9 checks passed
@romaintb
romaintb deleted the refactor/sidebar-selection-by-uuid branch September 5, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant