From 05c8b1f1dc14a665bc2d6e79fa4a689c7ea01fb7 Mon Sep 17 00:00:00 2001 From: Thieu Nguyen <79964592+thieung@users.noreply.github.com> Date: Tue, 24 Mar 2026 21:15:22 +0700 Subject: [PATCH] [In Progress] fix(ui): show toast error when package install/uninstall fails (#440) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(ui): show toast error when package install/uninstall fails HttpClient throws ApiError on HTTP 500 responses, but installPackage and uninstallPackage hooks did not catch the exception. This caused the error to propagate past the toast logic, so users saw no feedback when a system package failed to install. Wrap http.post calls in try/catch to always show toast with the server error message. Update PackageSection handlers to check res.ok instead of relying on try/catch for flow control. * fix(ui): truncate verbose package error in toast notification Extract last meaningful error line (e.g. "ERROR: ...") from package manager output instead of dumping the full multi-line response into the toast, which caused text overflow. * fix(ui): wrap long text in toast instead of truncating Add break-words and min-w-0 to toast content so long error messages (URLs, package manager output) wrap properly within the toast element. Remove shortError helper — show full error with proper wrapping. * fix(ui): constrain toast container width to prevent overflow Move max-w-sm from toast item to the fixed container so long text (URLs, multi-line errors) is properly bounded. Add overflow-hidden on toast items as a safety net. * fix(pkg-helper): re-add packages cascade-removed by apk del apk del removes orphaned dependencies, which may include other user-installed packages if they were pulled in as transitive deps. After uninstalling, check which persisted packages are still present and re-install any that were accidentally removed. * revert: remove cascade re-add logic from pkg-helper apk del does not cascade-remove other world packages (verified via Docker test). The re-add logic was based on incorrect assumption. Root cause of the all-packages-deleted issue needs further investigation. --- ui/web/src/components/ui/toaster.tsx | 10 ++--- .../src/pages/packages/hooks/use-packages.ts | 45 ++++++++++++------- ui/web/src/pages/packages/packages-page.tsx | 16 +++---- 3 files changed, 42 insertions(+), 29 deletions(-) diff --git a/ui/web/src/components/ui/toaster.tsx b/ui/web/src/components/ui/toaster.tsx index 5460a9fc..eeea9b34 100644 --- a/ui/web/src/components/ui/toaster.tsx +++ b/ui/web/src/components/ui/toaster.tsx @@ -23,16 +23,16 @@ function ToastItem({ toast }: { toast: Toast }) { return (
{toast.title}
+{toast.title}
{toast.message && ( -{toast.message}
+{toast.message}
)}