[6.x] Dedupe concurrent Control Panel asset requests - #15252
Merged
Conversation
Multiple asset fields, markdown fields, and Bard image nodes on the same page each fire their own POST to assets-fieldtype on mount. When those requests are identical and concurrent, share one promise instead. The shared promise is dropped as soon as it settles, so this only ever collapses in-flight duplicates - no settled response is ever reused.
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.
A publish form with several asset fields fires the same
assets-fieldtyperequest once per field. Markdown fields and Bard image nodes hit the same endpoint. When those requests are identical and concurrent, share one promise instead of sending duplicates.dedupeInFlight(namespace, key, factory)collapses concurrent identical in-flight work onto a single shared promise. The entry is dropped as soon as the promise settles, so no settled response is ever reused — this is not a cache and has no staleness window. Every caller receives the same real response, and if the request fails they all reject together.The assets fieldtype clones its copy of the response so edits to one field's asset rows can't bleed into another field sharing the same in-flight response.
Split out of #15158.