Skip to content

Avoid mutating audioDataArray in WAV export fallback #290

@maboa

Description

@maboa

Background

The WAV export click handler at index.html:1872-1879 pushes a fallback "whole file" AudioData into the shared audioDataArray when it's empty. That mutates module-level state from a click handler. Currently harmless (checkStrikeThrus early-returns when audioDataArray.length < 2) but it's a latent side effect that will bite when more code reads the array.

Proposed change

Build a local export array instead, leave audioDataArray alone.

const exportData = audioDataArray.length > 0
  ? audioDataArray
  : [new AudioData(player.src, 0, player.duration)];
const wavBlob = await cutAudioApp.cutAudio(exportData);

Acceptance criteria

  • Export handler does not push into audioDataArray.
  • Whole-file fallback still works when no transcript has been loaded.
  • No observable behavior change for users.

Notes

May be subsumed by the export-modal work — but small and safe to land independently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions