fix(dashboard): prevent stale saving indicator when desc requests overlap - #38294
Closed
AhmetArif0 wants to merge 1 commit into
Closed
fix(dashboard): prevent stale saving indicator when desc requests overlap#38294AhmetArif0 wants to merge 1 commit into
AhmetArif0 wants to merge 1 commit into
Conversation
handleSaveDesc and handleAutoDescribe both set their loading flag in a try block but always cleared it unconditionally in finally. When a user opened profile A's description editor, clicked Save, then quickly switched to profile B's editor and saved, profile A's resolving request would clear descSaving/describing while profile B's request was still in-flight, making the "Saving…" indicator disappear prematurely. Track concurrent in-flight counts with descSavingCount and describingCount refs (mirrors the existing activeDescRequest guard pattern). The loading flag is cleared only when the counter reaches zero, i.e. all overlapping requests have settled.
Contributor
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.
Problem
handleSaveDescandhandleAutoDescribeon the Profiles page both setdescSaving/describingtotrueat the start of a request, then unconditionally cleared them infinally:All other side-effects in these handlers are already guarded by
if (activeDescRequest.current === name)to ignore stale responses — but the loading flag was not.Reproduction:
finallyfires →setDescSaving(false)clears the indicator even though Profile B's request is still in-flight.The same race exists in
handleAutoDescribewithsetDescribing.Fix
Add
descSavingCountanddescribingCountrefs that count concurrent in-flight requests. The loading flag is cleared only when the counter reaches zero — i.e. all overlapping requests have settled:This mirrors the existing
activeDescRequestguard pattern already used throughout these handlers.Test plan
describingindicator is not cleared early