Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (codex): key the drum sheet by song id so its scroll reset can't ride on an incidental unmount

[._.]/ Adam Eivy56f31044db24
diff --git a/client/src/components/songbook/DrumSheetView.jsx b/client/src/components/songbook/DrumSheetView.jsx
index 40807cc027..1fe871c3a7 100644
--- a/client/src/components/songbook/DrumSheetView.jsx
+++ b/client/src/components/songbook/DrumSheetView.jsx
@@ -240,7 +240,9 @@ function DrumSheetView({
return () => { cancelAnimationFrame(raf); hide(); };
}, [playing, getPlayhead, barCount, barX, laneW, scale]);
- // A new chart is a new song — start reading it from the top.
+ // A new chart starts from the top. Content-keyed, so a host that can show two
+ // DIFFERENT records with identical charts in one mounted sheet should key this
+ // component by record id (SongBookViewer does).
useEffect(() => {
if (scrollRef.current) scrollRef.current.scrollLeft = 0;
}, [chart]);
diff --git a/client/src/pages/SongBookViewer.jsx b/client/src/pages/SongBookViewer.jsx
index c22e42306c..4ffb2e65fc 100644
--- a/client/src/pages/SongBookViewer.jsx
+++ b/client/src/pages/SongBookViewer.jsx
@@ -694,6 +694,12 @@ export default function SongBookViewer() {
// scroller, so capping it just shortens the window you read
// through on a wide screen.
<DrumSheetView
+ // Keyed on the song, not just its text: the sheet resets its
+ // horizontal scroll when the CHART changes, and two songs can
+ // hold identical charts. Today the load's `setSong(null)`
+ // unmounts the sheet between songs anyway, but that's an
+ // incidental guarantee — the key makes it the sheet's own.
+ key={id}
text={contentText}
fontSizeRem={fontSize}
getPlayhead={drum.getPlayhead}