Description
Two related bugs occur when creating and editing custom tunes:
Bug A — Editor dialog closes on edit
When a user creates a new tune and edits its pattern, the pattern editor dialog closes unexpectedly as soon as a stroke is modified. This makes it very difficult to edit custom patterns.
Bug B — Custom tunes disappear from current state
After creating custom tunes, they can disappear from the current view. Users have to navigate back through the history picker to recover them.
Root cause
Both bugs are caused by a feedback loop in src/services/history.ts. The storage watcher (line 50) triggers loadHistoricState() after every saveCurrentState() call. This can replace the entire state.value object, which disrupts the modal lifecycle and can cause data loss.
Steps to reproduce
- Go to the Compose tab
- Click New tune, enter a name, confirm
- In the pattern editor that opens, try to edit strokes → dialog closes (Bug A)
- Create multiple tunes, refresh the page → some tunes are missing (Bug B)
Fix
See PR #145
Description
Two related bugs occur when creating and editing custom tunes:
Bug A — Editor dialog closes on edit
When a user creates a new tune and edits its pattern, the pattern editor dialog closes unexpectedly as soon as a stroke is modified. This makes it very difficult to edit custom patterns.
Bug B — Custom tunes disappear from current state
After creating custom tunes, they can disappear from the current view. Users have to navigate back through the history picker to recover them.
Root cause
Both bugs are caused by a feedback loop in
src/services/history.ts. The storage watcher (line 50) triggersloadHistoricState()after everysaveCurrentState()call. This can replace the entirestate.valueobject, which disrupts the modal lifecycle and can cause data loss.Steps to reproduce
Fix
See PR #145