Skip to content

Conversation

adzhindzhi
Copy link
Contributor

@adzhindzhi adzhindzhi commented Oct 3, 2025

Resolves

UEPR-386

Proposed Changes

  • Check if a sound with the provided index exists before trying to access its data

Reason for Changes

  • This issue became visible after the React 18 upgrade. After a sound is removed for the first time, mapStateToProps is not re-evaluated, so no error occurs. On subsequent deletions, however, mapStateToProps is re-run via handleSubsequentCalls, which ends up calling getSoundBuffer when this.editingTarget.sprite.sounds[soundIndex] is already empty. This bug existed before React 18, but my assumption is that the previous React-Redux implementation swallowed errors thrown inside mapStateToProps, preventing them from surfacing. With React 18 errors thrown during render are no longer suppressed and now propagate, which is why the editor crashes after the upgrade even though the underlying bug was always present.

@adzhindzhi adzhindzhi requested a review from a team as a code owner October 3, 2025 08:39
@adzhindzhi adzhindzhi requested a review from KManolov3 October 3, 2025 08:40
@adzhindzhi adzhindzhi changed the title Bugfix/uepr 386 sound editor crashes [UEPR-386] Sound editor crashes Oct 3, 2025
Copy link
Contributor

@KManolov3 KManolov3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this so quickly!

@adzhindzhi adzhindzhi merged commit 62dde2c into scratchfoundation:uepr56-react18 Oct 3, 2025
6 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants