[2.x] fix: data race when cliking on shared media, multiple times - #487
Merged
imorland merged 3 commits intoSep 2, 2026
Merged
Conversation
3 tasks
imorland
force-pushed
the
gvn/fix_shared_media_data_race_2x
branch
from
September 2, 2026 16:42
97099a3 to
5bc6973
Compare
Builds on the original fix, which guarded in SharedFileList.loadFileList. The invariant being protected — parseResults concatenating unconditionally — lives in FileListState, so guarding at the component left the other two entry points open: - loadMore() computes its offset from files.length, so two concurrent calls both requested the same page and appended it twice. - refresh() calls loadResults() directly, so the admin Shared Uploads refresh button was unprotected. Guarding inside loadResults() covers all three, and lets loadMore() drop its own `loading = true` which would otherwise have tripped the new guard. refresh() clears the flag deliberately so a deliberate refresh is never turned into a no-op. Also replaces the rethrow in the catch block. Every caller ignores the returned promise, so rethrowing only produced an unhandled rejection with nothing shown to the reader — and because the list renders "empty" whenever it has no files and is not loading, a failed request looked exactly like an empty library. The error is surfaced through a loadError flag and its own message instead.
imorland
force-pushed
the
gvn/fix_shared_media_data_race_2x
branch
from
September 2, 2026 17:47
5bc6973 to
b5f549f
Compare
setUser() clears files but was not clearing loading, so switching to a different user while a request was still running returned early from loadResults(). The new user's list was never fetched and they were left looking at an empty one — a regression from moving the guard into the state, since previously nothing blocked that call. Same one-line fix already applied to refresh().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #0000
Changes proposed in this pull request:
Reviewers should focus on:
Screenshot
Confirmed
composer test).Required changes: