Conversation
There was a problem hiding this comment.
Pull request overview
Adds hierarchical Tune Set grouping to the Repertoire tunes grid/list by introducing a mixed tune + tune-set row model (expandable parents with subrows), updating selection semantics to work with duplicated tunes, and wiring the repertoire tab to fetch visible sets + items.
Changes:
- Added
grouped-grid-rows.tshelpers to build mixed tune/tune-set rows (row ids, subrows, selection rules, auto-expand IDs). - Extended
TunesGrid+TuneStackedListto render expandable hierarchical rows in both grid and list modes, with set-row styling. - Updated repertoire selection consumers to use
getSelectedRowModel().flatRowsand dedupe tune IDs for bulk actions.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/components/grids/grouped-grid-rows.test.ts | Adds unit tests for mixed row building / grouping / search behavior. |
| src/routes/repertoire.tsx | Switches bulk selection semantics to flattened selected rows. |
| src/components/repertoire/RepertoireToolbar.tsx | Uses flattened selected rows and deduped tune IDs for toolbar actions. |
| src/components/grids/TuneStackedList.tsx | Adds list-mode hierarchy rendering (indentation + expand/collapse UI) and selection gating. |
| src/components/grids/TunesGridRepertoire.tsx | Fetches visible tune sets + items and builds mixed hierarchical rows for the repertoire tab. |
| src/components/grids/TunesGrid.tsx | Adds TanStack expanding/subrows support, hierarchy cell rendering, list-mode expansion wiring, and set-row styling. |
| src/components/grids/grouped-grid-rows.ts | Implements the reusable mixed tune/tune-set row builder and helper accessors. |
Comments suppressed due to low confidence (1)
src/components/grids/TunesGrid.tsx:642
- In list mode, row-selection state is keyed by TanStack row IDs (including compound IDs for subrows), but this handler uses
String(row.id)which is the tune/setidfrom the original data. For hierarchical rows this will (a) fail to toggle selection for subrows and (b) collide when the same tune appears under multiple sets. Userow.stacked_row_id(added instackedListData) as the selection key (fallback torow.idonly if needed).
const handleStackedRowSelectionChange = (
row: IStackedListRow,
checked: boolean
) => {
const rowId = String(row.id);
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…e grid Adds getBatchedTuneSetItemRefs to tune-sets.ts which fetches tuneSetRef, tuneRef and position for all visible set IDs in a single SQL query. This eliminates the previous N+1 pattern in TunesGridRepertoire where each set triggered getTuneSetAccessForUser + item fetch + per-item getTuneRow. Access control is satisfied by the prior getVisibleTuneSets call so no per-set access re-check is needed; no tune-row hydration is performed since the hierarchy builder only needs tuneRef and position. Also adds unit coverage for getBatchedTuneSetItemRefs in the existing groups-and-tune-sets test file (empty-input shortcut, multi-set fetch, position ordering, deleted-item exclusion). Agent-Logs-Url: https://github.com/sboagy/tunetrees/sessions/c942beb5-37c0-4606-9645-7836f577652b Co-authored-by: sboagy <136380088+sboagy@users.noreply.github.com>
| return getTuneIdsForTuneSets( | ||
| params.db, | ||
| visibleSets.map((set) => set.id), | ||
| params.userId | ||
| ); |
| <For each={props.data}> | ||
| {(item) => { | ||
| const itemId = item.tune_id ?? item.id; | ||
| const rowId = String(item.id); | ||
| const rowId = String(item.stacked_row_id ?? item.id); | ||
| const checkboxIdentifier = String(item.id); | ||
| const rowDepth = item.stacked_depth ?? 0; |
|
@copilot apply changes based on the comments in this thread |
… for stacked-item testid
repertoire.tsx:
- Both selectedTuneSetTuneIds and anyTuneSetTuneIds resources now use
getBatchedTuneSetItemRefs instead of getTuneIdsForTuneSets. This avoids
the per-set getTuneSetAccessForUser + item fetch + per-item getTuneRow
round trips that getTuneIdsForTuneSets performs. Unique tune IDs are
collected client-side with new Set().
TuneStackedList.tsx:
- data-testid for the <li> element now uses rowId (TanStack row ID, e.g.
set-{setId}-tune-{tuneId}) instead of itemId (tune_id ?? id). When the
same tune appears in multiple sets itemId is identical for both rows, so
using it as a DOM identifier produces non-unique testids and makes
test/automation selectors ambiguous. rowId is always unique. The
isSelected() comparison continues to use itemId since current-tune
selection is by tune identity, not by position in the hierarchy.
Agent-Logs-Url: https://github.com/sboagy/tunetrees/sessions/247b26ed-76bc-481a-81f9-9d11e8547307
Co-authored-by: sboagy <136380088+sboagy@users.noreply.github.com>
Done in commit
|
Summary
What changed
grouped-grid-rows.tsto build mixed tune/set rows, row ids, subrow access, and row-selection rules for hierarchical tune gridsTunesGridwith reusable hierarchy support: expandable rows, row id/subrow hooks, auto-expanded parents, hierarchy-aware list data, and set-row stylingTuneStackedListto support hierarchical rows in list mode so the Display Options toggle works again for repertoireTunesGridRepertoireto fetch visible tune sets and tune-set items, then build mixed tune/set rows for the repertoire tabgetSelectedRowModel().flatRowsand dedupe ontune_id ?? idUser-visible behavior
Validation
npx vitest run tests/components/grids/grouped-grid-rows.test.tsnpx tsc -p tsconfig.app.json --noEmitnpm run lint && npm run check && npm run typecheck && npm run test:unitNotes