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

fix: revise a reloaded painting at its own length (#8464)

[._.]/ Adam Eivy4ba269eb8c60
diff --git a/client/src/components/music/WaveformPanel.jsx b/client/src/components/music/WaveformPanel.jsx
index c2677d619e..cadfeafae6 100644
--- a/client/src/components/music/WaveformPanel.jsx
+++ b/client/src/components/music/WaveformPanel.jsx
@@ -270,8 +270,10 @@ export default function WaveformPanel({
const [sketch, setSketch] = useState(() => normalizeWaveSketch(track?.waveSketch));
const [guidance, setGuidance] = useState('');
// Raw field text — clamped only when used, so typing "12" isn't snapped to
- // the minimum after its first digit.
- const [lengthInput, setLengthInput] = useState(String(DEFAULT_LENGTH_SEC));
+ // the minimum after its first digit. It follows the current sketch's length,
+ // so revising a reloaded painting keeps its duration instead of cropping it.
+ const [lengthInput, setLengthInput] = useState(() => String(sketch?.durationSec ?? DEFAULT_LENGTH_SEC));
+ useEffect(() => { if (sketch) setLengthInput(String(sketch.durationSec)); }, [sketch]);
const [review, setReview] = useState(false);
const [drawing, setDrawing] = useState(null); // 'fresh' | 'revise' | null
const [saving, setSaving] = useState(false);
diff --git a/client/src/components/music/WaveformPanel.test.jsx b/client/src/components/music/WaveformPanel.test.jsx
index cabacae6e1..a4b74d766d 100644
--- a/client/src/components/music/WaveformPanel.test.jsx
+++ b/client/src/components/music/WaveformPanel.test.jsx
@@ -117,11 +117,14 @@ describe('<WaveformPanel>', () => {
expect(screen.getByText(/Nothing painted yet/)).toBeTruthy();
});
- it('opens on the host track\'s stored painting without fetching', () => {
- renderPanel({ track: { id: 'track-1', waveSketch: painted } });
+ it('opens on the host track\'s stored painting without fetching, and revises it at its own length', async () => {
+ renderPanel({ track: { id: 'track-1', waveSketch: { ...painted, durationSec: 95 } } });
expect(screen.getByText('Glass Tide')).toBeTruthy();
- expect(screen.getByRole('button', { name: /Revise painting/ })).toBeTruthy();
expect(api.getTrack).not.toHaveBeenCalled();
+ expect(screen.getByLabelText('Length (sec)').value).toBe('95');
+ fireEvent.click(screen.getByRole('button', { name: /Revise painting/ }));
+ await waitFor(() => expect(api.drawTrackWaveform).toHaveBeenCalledTimes(1));
+ expect(api.drawTrackWaveform.mock.calls[0][1]).toMatchObject({ revise: true, durationSec: 95 });
});
it('still shows, plays, and saves a v1 drawing, which is repainted rather than revised', async () => {