Repository navigation
fix(record-bin): stop blocking on toasts and show failures as errors - #172
Merged
Merged
Conversation
…tices The `ctx.notice()` promise settles when the toast closes, about six seconds after it opens. Both deletion-blocking paths awaited it, which held the hook open after the decision was made. The CMS then reported Record Bin as slow with its "taking longer than usual" warning. Show the notices without awaiting them and log display failures in debug mode. Refs #152 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both deletion-blocking messages used `ctx.notice()`, which the SDK renders as a green success toast. Use `ctx.alert()`, the error toast, as the rest of the plugin already does for failures. Refs #152 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`ctx.alert()` resolves only when the user closes the error toast. Code that awaited it kept the Restore, Save and Disconnect buttons busy until then, and delayed opening a restored record whose archive cleanup failed. Show those alerts without awaiting them. Settings save also reported a webhook cleanup failure as a green success notice and awaited it for six seconds; use a non-blocking alert instead. Refs #152 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deleting a record now shows "Record Bin is saving a copy of this record before it is deleted…" right away, so the few-second wait reads as work in progress. The toast is fired, not awaited: its promise settles only when it closes, and awaiting it would hold onBeforeItemsDestroy open. It closes on page change (a successful delete leaves the record) or after 15 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
roger-datocms
force-pushed
the
fix/record-bin-notice-without-wait
branch
from
November 3, 2026 21:02
1807aad to
7c573e1
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Should be ready to merge along with #171 |
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.
(Claude here [Opus 5.5])
Toast fixes from #152. It's independent of #171.
Problem
The plugin SDK has two toasts, and they behave differently. I measured both in a sandbox with a probe plugin:
ctx.notice()ctx.alert()Record Bin awaited toasts in several flows, so those flows stalled:
onBeforeItemsDestroyawaited a green notice. That covers "could not verify a complete archive" and the over-200-records guard. The hook stayed open about 6 s after deciding, and the CMS reported Record Bin as slow ("taking longer then usual…onBeforeItemsDestroy").finallythat resets loading and the in-progress lock ran only after the awaited alert.Fix
ctx.alert(), the error toast. Elsewhere, the plugin already uses it for failures.alertFninBinOutletis now fire-and-forget, likenoticeFn.Tests
lambdaLessCapture.test.ts, and the over-200 guard inindex.test.tsx.BinOutlet.test.tsxcovers the Lambda-less restore flow, with an alert that never settles. A failed restore must finish, and a restore with failed cleanup must still open the record. This exportsexecuteRestoreWithoutLambdafor the test.ConfigScreenchanges have no unit tests. Testing its handlers needs a DOM test setup, which the plugin doesn't have.npm test(107 tests; 108 combined with #171) andtsc --noEmitpass inrecord-bin. Biome reports one error, a format error inrecordBinModel.test.tsthat is already on master.Sandbox results
masterBlocked deletion, about 6 s after confirming. Before: a green toast and the slow-plugin warning.
After: only a red error toast.
Failed restore, 15 s after clicking with the alert still open. Before: "Restore record" is still disabled.
After: the button is ready for a retry.
Narrated before/after walkthrough of #171 + #172 in a legacy-flag sandbox (captions below the video):
record-bin-171-172-walkthrough.mp4
🤖 Generated with Claude Code