fix: cancel download fetch when progress toast is closed (#27152)
* fix: cancel download fetch when progress toast is closed - Create new progress-toast utility using @coss/ui toastManager - Add ToastProvider to app providers - Update download components to use AbortController for cancellation - When cancel button is clicked, abort signal stops the fetch loop Co-Authored-By: [email protected] <[email protected]> * fix: track active toasts with Set instead of accessing toastManager.toasts Co-Authored-By: [email protected] <[email protected]> * feat: add AnchoredToastProvider to app providers Co-Authored-By: [email protected] <[email protected]> * refactor: extract common CSV download logic into useCsvDownload hook Co-Authored-By: [email protected] <[email protected]> * refactor: improve progress toast with i18n support and Progress component Co-Authored-By: [email protected] <[email protected]> * refactor: replace useCsvDownload hook with DownloadButton component Co-Authored-By: [email protected] <[email protected]> * refactor: rename DownloadButton to CsvDownloadButton Co-Authored-By: [email protected] <[email protected]> * clean up i18n * fix: properly throw AbortError when download is cancelled Co-Authored-By: [email protected] <[email protected]> * Revert "fix: properly throw AbortError when download is cancelled" This reverts commit 3c64b848140271e4dcd2e45dba5302eef9ca562c. * fix abort controller * fix layout shift * better handle error * fix: address Cubic AI review feedback - Fix typo 'copmlete' -> 'complete' in download_progress i18n string - Treat null batch as failure during CSV download to prevent partial exports Co-Authored-By: unknown <> * remove redundant try - catch --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
7 files changed
+256
-268
No files matched your search
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { AnchoredToastProvider, ToastProvider } from "@coss/ui/components/toast";
|
||||
import { TrpcProvider } from "app/_trpc/trpc-provider";
|
||||
import { SessionProvider } from "next-auth/react";
|
||||
import CacheProvider from "react-inlinesvg/provider";
|
||||
@@ -27,7 +28,11 @@ export function Providers({ isEmbed, children, country }: ProvidersProps) {
|
||||
{!isEmbed && !isBookingPage && <NotificationSoundHandler />}
|
||||
{/* @ts-expect-error FIXME remove this comment when upgrading typescript to v5 */}
|
||||
<CacheProvider>
|
||||
<WebPushProvider>{children}</WebPushProvider>
|
||||
<WebPushProvider>
|
||||
<ToastProvider>
|
||||
<AnchoredToastProvider>{children}</AnchoredToastProvider>
|
||||
</ToastProvider>
|
||||
</WebPushProvider>
|
||||
</CacheProvider>
|
||||
</TrpcProvider>
|
||||
</SessionProvider>
|
||||
|
||||
Reference in new issue
Block a user