[Website] Add error notices and delete confirmation modal to site management#3454
Open
[Website] Add error notices and delete confirmation modal to site management#3454
Conversation
…umers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves site-management UX by surfacing API errors inside modals and replacing blocking window.confirm deletion with a dedicated modal flow.
Changes:
- Add inline error notices to rename/save/delete site modals so API errors aren’t silently swallowed.
- Replace
window.confirmwith a newDeleteSiteModaland Redux UI state to track which site is being deleted. - Add JSDoc (
@param,@returns,@throws) documentation across thePlaygroundSitesAPIinterface.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/playground/website/src/lib/state/redux/slice-ui.ts | Adds DELETE_SITE modal slug and siteSlugToDelete UI state/action to support delete modal flow. |
| packages/playground/website/src/lib/state/redux/site-management-api-middleware.ts | Adds API JSDoc and updates error/guard behavior for active-site operations and deletion messaging. |
| packages/playground/website/src/lib/state/redux/persist-temporary-site.ts | Lets directory picker errors propagate so callers can show cancellation/errors in UI. |
| packages/playground/website/src/components/site-manager/site-info-panel/index.tsx | Switches delete action from window.confirm + API call to opening the delete modal with selected slug. |
| packages/playground/website/src/components/saved-playgrounds-overlay/index.tsx | Switches delete action to open delete modal (instead of confirming + calling API directly). |
| packages/playground/website/src/components/save-site-modal/index.tsx | Displays real error messages via <Notice> and moves error notice above action buttons. |
| packages/playground/website/src/components/rename-site-modal/index.tsx | Shows rename errors inline via <Notice> and unifies form layout via shared modal form CSS. |
| packages/playground/website/src/components/modal/style.module.css | Adds shared .modal-form styling for consistent modal form layout. |
| packages/playground/website/src/components/layout/index.tsx | Wires DELETE_SITE slug to render the new DeleteSiteModal. |
| packages/playground/website/src/components/delete-site-modal/index.tsx | Introduces a delete confirmation modal with inline error handling. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/playground/website/src/components/saved-playgrounds-overlay/index.tsx
Show resolved
Hide resolved
packages/playground/website/src/components/delete-site-modal/index.tsx
Outdated
Show resolved
Hide resolved
packages/playground/website/src/lib/state/redux/site-management-api-middleware.ts
Show resolved
Hide resolved
When the DELETE_SITE modal is active but the target site no longer exists (e.g. stale URL), dispatch closeModal actions so the URL param is cleaned up. Also remove the storage === 'none' guard since both callers already prevent temporary sites from reaching this modal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
These modals require Redux state (siteSlugToDelete / siteSlugToRename) that is not persisted in the URL, so restoring them from a stale URL param would silently show nothing. Exclude them like save-site and remove the now-unnecessary cleanup effect from DeleteSiteModal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Motivation for the change, related issues
Follow-up to PR feedback on #3401. The
PlaygroundSitesAPImethods throw descriptive errors for MCP consumers, but UI components were silently swallowing them. Additionally, site deletion usedwindow.confirm, which is inconsistent with the rest of the modal-based UI and blocks the main thread.Implementation details
Error notices in modals
sitesAPI.rename()and displays them in a<Notice>component.sitesAPI.delete()and displays them inline.Delete confirmation modal
window.confirmwith a newDeleteSiteModalcomponent, consistent with the existing rename/save modal pattern.DELETE_SITEmodal slug andsiteSlugToDeleteUI state to the Redux store.window.confirm.API documentation
@param,@returns, and@throwstags to every method on thePlaygroundSitesAPIinterface.Minor cleanups
getActiveSiteOrThrow— each call site now checks and throws with a context-specific message ("No active site selected").persistTemporarySitenow letsshowDirectoryPickererrors propagate instead of silently returning, so callers can handle cancellation.storage === 'none'safety-net checks that are no longer needed.Testing Instructions
Testing Instructions
save-site-modal/index.tsx, addthrow new Error('test')before thepersistTemporarySitecall inhandleSubmitrename-site-modal/index.tsx(beforesitesAPI.rename()) anddelete-site-modal/index.tsx(beforesitesAPI.delete())throwstatements