Skip to content

Track steps are not properly removed/disposed when they change #42

@brandongregoryscott

Description

@brandongregoryscott

It looks like the <Track /> component is not properly removing or disposing of steps when props change. I ran into this on my own project using reactronica, but I've reproduced the issue in a smaller sandbox environment: https://codesandbox.io/s/reactronica-42-step-duplication-bug-qnd8h?file=/src/App.tsx

To reproduce in the sandbox:

  1. Wait for the samples to load (Play button will be disabled until onLoad runs)
  2. Play the initial state of the Track which includes 4 hi-hat notes and a kick on the first step.
  3. Pause the track.
  4. Toggle the steps to be the hi-hat only set.
  5. Play the track again. (You should hear hi-hats only)
  6. Pause the track, and toggle the steps.
  7. Play the track - on this time around, you'll notice the kick and hi-hats sound louder. (as if they are layered on top of the original array of steps)
  8. Pause the track, then toggle the steps back to the hi-hat only set.
  9. Play the track - you will hear both the kick and hi-hats, and they sound even louder.

I've patched the issue in a branch of my fork (85405d7) which I've tested against my project using reactronica, but not this sandbox example. I imagine it will resolve it, too, but I'm not 100% sure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions