Repository navigation
Conversation
The modal tracked a single busySlug and disabled only that row's buttons,
so Load A followed by Load B overwrote the marker: both requests ran, both
called onLoaded, and the later response won. Each `finally` also cleared
the marker unconditionally, re-enabling a row whose operation was still in
flight.
Save and every row's Load/Rename/Delete now share one slot (state for the
render, a ref for handlers), and every action is disabled while it is held.
A successful Load closes the modal, so nothing useful can run beside it. An
operation releases the slot only if it still holds it. A status line names
the running row operation, which also explains why the buttons are disabled.
Save, Rename and Delete now block X, Escape and the backdrop until they
settle. The old `onClose={saving ? undefined : onClose}` did not block: on
X or backdrop Carbon hid the dialog while the parent's `open` stayed true,
so the toolbar could not reopen it. Escape still closed it, because Carbon
registers its Escape listener once per open and keeps that render's
onClose. The guard returns false from a stable handler that reads the
slot's ref, which holds on all three paths. A Load stays dismissible; it is
cancelled on close in the next commit.
Refs #92
A Load stayed live after X, Escape or the backdrop dismissed the modal. Nothing cancelled getConfig, and the modal is always mounted, so the response still called onLoaded and replaced the workspace after the dialog was gone. A reopen also kept the dismissed row's Load disabled until the old request settled, and then that stale response closed the new dialog. Each open is now a session. Closing ends it in requestClose and again in the `open` -> false effect (unmounting ends it too), and ending a session aborts the pending Load through the signal getConfig already accepts. Every operation applies its result, including errors, only while its session is current, which also covers a response that beat the abort. A reopen releases a slot still held by a dismissed Load. It leaves a Save, Rename or Delete in place: those block dismissal, so one can only reach a reopen through a close the parent made itself, and it is still running. The slot is released by identity rather than by session, so such an operation frees it when it settles, and a stale Load can't free a newer operation's slot. Refs #92
Save, Rename and Delete held the busy slot through the list refresh that follows them, so a hung listConfigs left the dialog impossible to close. Before this branch Rename and Delete never blocked closing, so that would have been a regression. The refresh is only a read, so the slot is now released as soon as the server call settles, and only the mutation itself blocks dismissal. Also from review: - A successful Load ends its session before calling onClose, as requestClose does, so every close path ends the session first. - Test two Load clicks that land before React re-renders. Only the slot's ref can turn the second one away, because its button is still enabled. - Rename a test whose name overstated what it checks. - Share one label helper between the status line and the delete prompt. Refs #92
Save kept the busy slot until the clipboard write settled, so a pending clipboard permission prompt left every action disabled and X, Escape and the backdrop blocked after the workspace was already saved. Free the slot, clear the form and start the refresh as soon as saveConfig resolves; the copy and the toast follow, and the toast still goes out if the dialog has closed in the meantime. Refs #92
Main reworked the config store in #79: a Carbon dialog confirms deletes, toasts carry a timeout, a Load aborts on unmount and when a newer Load supersedes it, and TraceApp mounts the modal only while it's open. The resolution keeps this PR's one-operation-at-a-time slot and its cancel-on-dismiss sessions, with main's changes on top: - Delete goes through main's confirmation dialog. Confirming claims the slot. While the delete's server call runs, the dialog's X, Escape and Cancel are refused, read from the slot's ref: Carbon keeps the onClose from the render that opened the dialog, so a guard on render state let Escape close it mid-delete. The store refuses to close under the dialog, and a failure shows in the dialog, which stays open for a retry. - A second Load stays blocked rather than superseding the first, so main's supersede path is gone. Ending the session already aborts a pending Load on unmount. - Main's toast timeouts and Load warnings are kept. - Each open is a fresh mount now, so this PR's reset-on-reopen code is dropped. The tests are one file on this PR's deferred-promise harness, which now mounts the modal the way TraceApp does. Main's dialog and share-link timeout tests are ported. Its superseded-Load test gives way to the first-click-wins tests; its Save-dismissal and unmount-abort tests duplicated existing ones. New tests cover dismissing the confirmation before and during a delete, a delete failure and retry, and the Load toast's warnings.
Cancelling the delete confirmation (X, Escape or Cancel) after a failed Delete left the error set, so the store's banner showed it for a Delete that had been cancelled. requestCancelDelete now clears it. Name both dialogs with aria-label. Carbon names a ComposedModal from its aria-label or ModalHeader's label, not the title, so both were unnamed. The tests now find the dialogs, rows and the confirmation's Delete by role and name, and tell open from closed by aria-hidden, instead of reading Carbon's class names. Escape-driven steps keep the onClose guards covered: Carbon only sends Escape to a modal it still shows.
4 of 5 tasks
zdomke
reviewed
Nov 13, 2026
zdomke
left a comment
Contributor
There was a problem hiding this comment.
Compared against the archived PR's review (slaclab/react-trace-archive#129): Copilot's one finding (clipboard write holding the Save slot) and my two findings (stale delete error leaking after cancel; tests coupled to Carbon's internal CSS classes) are all fixed and verified present here.
A fresh pass over the current diff found a real, confirmed concurrency bug not caught by the archived review — see inline comment. Not approving yet.
begin() checked only the busy slot, which a Delete takes only once it's confirmed. While the confirmation was open, a Load, Rename or Save from the store behind it could claim the slot. The confirmation's Delete then did nothing, a failed Rename showed under "Could not delete config", and a Load that succeeded closed the store, confirmation and all. begin() now turns away everything but the confirmation's own Delete while it is open. Rename checks this before its prompt, and a row's Delete can't switch the confirmation to another config. A Load's success closes through requestClose, like X, Escape and the backdrop.
This branch has not been deployed
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.
Closes #92.
Description
ConfigStoreModalnow runs one operation at a time, and lets the dialog close only when that's safe.main, the second aborts the first and wins.onClosefrom the render where the modal opened.Motivation
#92: one
busySluglet operations on different rows interleave and re-enable each other's buttons, and a dismissal during a Save, Rename or Delete either got through on Escape or hid the outcome.Review follow-up
begin()refuses everything except the confirmation's own Delete while it's open. Rename checks this before its prompt, and a row's Delete can't switch the confirmation to another config. A Load's success closes throughrequestClose.main. It keeps Keep keyboard focus in the config store's delete confirmation #177's delete-focus handling and ports its three focus tests into this file. It dropsmain's "aborts superseded loads and only applies the latest response" test, because this PR replaces that behaviour.Testing
ConfigStoreModal.test.tsxmocks every magpie call and settles each one by hand, so a case controls when a response lands relative to clicks and dismissals. The four cases for the review fix fail without it.main's dependencies:pnpm lint,format:checkandtypecheckare clean, and the full suite passes. This file also passes with ci: bump the npm-minor-and-patch group across 1 directory with 18 updates #196's dependencies (Carbon 1.120).Out of scope:
PostToElogModaluses the sameposting ? undefined : onCloseguard onmain. It needs the same fix in its own PR.