Use toast notification for preview changes#415
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the package-change workflow to use toast notifications during the preview phase and to improve error reporting when applying changes.
Changes:
- Add a “Previewing package changes” in-progress toast while computing dry-run previews.
- Skip opening the preview dialog when the dry-run indicates no solver side effects, and proceed directly to apply.
- Improve apply error toasts by showing a short first-line message with a “Show details” action.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| yarn.lock | Updates TypeScript patch resolution/checksum entries. |
| packages/common/src/packageActions.ts | Adds preview toast lifecycle, reuses dry-run preview results, and enhances error toast details/actions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } else { | ||
| Notification.error((error as any).message); | ||
| Notification.emit(firstLine, 'error', { | ||
| autoClose: false, | ||
| actions: [ | ||
| { |
There was a problem hiding this comment.
In the error path where toastId is still empty, the code emits an error toast but does not dismiss previewAllNotification, which can leave the in-progress preview toast lingering alongside the error. Dismiss previewAllNotification in this branch as well (ideally via a shared cleanup/finally).
| const removePreview = await pkgModel.dry_run_preview( | ||
| toRemove, | ||
| 'remove', | ||
| theEnvironment | ||
| ); | ||
| const updatePreview = await pkgModel.dry_run_preview( | ||
| toUpdate, | ||
| 'update', | ||
| theEnvironment | ||
| ); | ||
| const installPreview = await pkgModel.dry_run_preview( | ||
| toInstall, | ||
| 'install', | ||
| theEnvironment | ||
| ); |
There was a problem hiding this comment.
The three dry_run_preview calls are awaited sequentially, which increases latency compared to the previous behavior where the dialog loaded previews concurrently via Promise.all. Consider running these previews in parallel (e.g., await Promise.all([...])) and then using the results for has_side_effects checks / job data.
| const removePreview = await pkgModel.dry_run_preview( | |
| toRemove, | |
| 'remove', | |
| theEnvironment | |
| ); | |
| const updatePreview = await pkgModel.dry_run_preview( | |
| toUpdate, | |
| 'update', | |
| theEnvironment | |
| ); | |
| const installPreview = await pkgModel.dry_run_preview( | |
| toInstall, | |
| 'install', | |
| theEnvironment | |
| ); | |
| const [removePreview, updatePreview, installPreview] = await Promise.all([ | |
| pkgModel.dry_run_preview(toRemove, 'remove', theEnvironment), | |
| pkgModel.dry_run_preview(toUpdate, 'update', theEnvironment), | |
| pkgModel.dry_run_preview(toInstall, 'install', theEnvironment) | |
| ]); |
Co-authored-by: Copilot <[email protected]>
No description provided.