From c0ca4d7913af89e1af78172af9635002cf746717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Tue, 18 Nov 2025 14:53:31 +0100 Subject: [PATCH] fix: migrate existing tracks to new 180px height from localStorage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added migration logic to useMultiTrack hook: - When loading tracks from localStorage, check if height < DEFAULT_TRACK_HEIGHT - Automatically upgrade old heights (120px, 150px) to new default (180px) - Preserves custom heights that are already >= 180px This fixes the inline style issue where existing tracks had style="height: 120px" that was cutting off the level meter. After this update, refreshing the page will automatically upgrade all existing tracks to the new height without losing any data. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- lib/hooks/useMultiTrack.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/hooks/useMultiTrack.ts b/lib/hooks/useMultiTrack.ts index cff6faa..094aa62 100644 --- a/lib/hooks/useMultiTrack.ts +++ b/lib/hooks/useMultiTrack.ts @@ -2,6 +2,7 @@ import { useState, useCallback, useEffect } from 'react'; import type { Track } from '@/types/track'; import { createTrack, createTrackFromBuffer } from '@/lib/audio/track-utils'; import { createEffectChain } from '@/lib/audio/effects/chain'; +import { DEFAULT_TRACK_HEIGHT } from '@/types/track'; const STORAGE_KEY = 'audio-ui-multi-track'; @@ -29,6 +30,7 @@ export function useMultiTrack() { return parsed.map((t: any) => ({ ...t, name: String(t.name || 'Untitled Track'), // Ensure name is always a string + height: t.height && t.height >= DEFAULT_TRACK_HEIGHT ? t.height : DEFAULT_TRACK_HEIGHT, // Migrate old heights audioBuffer: null, // Will need to be reloaded effectChain: t.effectChain || createEffectChain(`${t.name} Effects`), // Restore effect chain or create new selection: t.selection || null, // Initialize selection