Skip to content

The Extract "All" button lights up when only some stems are selected #658

Closed

Description

@thcp

Reported as part of #657.

What goes wrong

The All button in the Extract row claims every stem is selected when only some are. It is not limited to one path: it is wrong after any page load.

Reproduced against a real import, choosing vocals and drums only:

Moment Stem chips All button
Chose vocals + drums vocals, drums correctly off
Separation finished, same session vocals, drums correctly off
After a reload vocals, drums lit
Opened that track from the library vocals, drums lit

So the one place it is reliably right is the moment after you click a stem, which is also the only moment you do not need it to tell you anything.

Why

syncAllBtn lives inside wireAllButton in static/js/main.js and is called in exactly two situations: once while wiring, and on a click of a stem chip or of All itself. Nothing else can reach it.

Both of the paths that set the selection without a click therefore leave it stale:

  • On load. The saved selection is restored asynchronously (stemSelectionReady in static/js/state.js), after the wiring has already run its one sync against the all-stems default. The chips get the restored value, All keeps the default.
  • Opening a library track. applyStoredStemSelection in static/js/catalog.js sets aria-pressed on each .stem-choice[data-stem] and never touches #stemAllBtn.

Constraints for whoever fixes it

  • The state is derived, not stored: All is on exactly when selectedStems.size === STEM_NAMES.length. It needs one owner that every path goes through, rather than a third caller bolted on, or the next path added will miss it the same way.
  • The restore is async and the wiring is not, so a fix that only reorders the calls will work until the store is slow.
  • Whatever refreshes the chips should refresh All in the same place. refreshStemChoiceVisuals is the obvious candidate, since both paths above already call it or do its job by hand.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions