Skip to content

Deleting a saved instrument leaves its files in the playground editor while the selector switches to Unilingual Form #1740

Closed

Description

@joshunrau

Deleting a saved instrument leaves its files in the playground editor and preview, while the instrument selector switches to Unilingual Form. removeInstrument sets selectedInstrument back to the default template but leaves files, indexFilename, openFilenames and selectedFilename alone, unlike setSelectedInstrument and resetInstruments. After Delete Instrument, the header says Unilingual Form and a notification says the instrument was deleted, but its code is still on screen under the template's name. Download Archive then exports the deleted code as Unilingual-Form.zip, and Create New Instrument clones it.

Where

apps/playground/src/store/slices/instrument.slice.ts:19-24:

removeInstrument: (id) => {
  set((state) => {
    state.instruments = state.instruments.filter((item) => item.id !== id);
    state.selectedInstrument = defaultSelectedInstrument;
  });
},

Reproduce

  1. Click Create New Instrument, name it Mine and save, then change index.ts and click Save.
  2. Open the actions menu (the vertical ellipsis), choose Delete Instrument and confirm.

Actual: the selector reads Unilingual Form, but the editor and preview still show Mine's code.
Expected: the editor and preview show the Unilingual Form template.

A node test of the store gives the same result: after setSelectedInstrument(saved.id) and then removeInstrument(saved.id), selectedInstrument.label is Unilingual Form and files still holds the removed instrument's contents.

Tests

apps/playground/src/store/slices/__tests__/instrument.slice.test.ts: it('should load the default instrument's files when the selected instrument is removed, so the editor never shows a deleted instrument').

E2E in testing/src/specs/playground.spec.ts: create and save an instrument with distinctive content, delete it from the actions menu, and assert that the editor shows the template's content.

Suggested fix

When the removed id is the selected instrument, have removeInstrument apply the same editor reset that resetInstruments does (files, index filename, open tabs and selection from defaultSelectedInstrument).

Activity

  1. added
    BugType: existing behavior is wrong
    Difficulty: LowIsolated change, about 2 hours or less
    Area: Playgroundapps/playground (in-browser instrument editor)
    Good First IssueWell-scoped, low-risk and self-contained; a good entry point for a new contributor
    on Oct 7, 2026
  2. added a commit that references this issue on Oct 29, 2026
    2daf0ce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: Playgroundapps/playground (in-browser instrument editor)BugType: existing behavior is wrongDifficulty: LowIsolated change, about 2 hours or lessGood First IssueWell-scoped, low-risk and self-contained; a good entry point for a new contributorPriority: MediumReal value; schedule normally

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions