Skip to content

Commit 9910237

Browse files
committed
fix(export): replace alert() with notification system
Use the existing useNotificationStore to show error messages instead of blocking browser alert(). Notifications appear in the bottom-right corner and can be dismissed by the user.
1 parent 3b9152f commit 9910237

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

apps/sim/app/workspace/[workspaceId]/w/hooks/use-export-service.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useCallback, useState } from 'react'
22
import { createLogger } from '@/lib/logs/console/logger'
3+
import { useNotificationStore } from '@/stores/notifications'
34

45
const logger = createLogger('useExportService')
56

@@ -29,6 +30,7 @@ interface UseExportServiceProps {
2930
*/
3031
export function useExportService({ getWorkflowId, onSuccess }: UseExportServiceProps) {
3132
const [isExporting, setIsExporting] = useState(false)
33+
const addNotification = useNotificationStore((state) => state.addNotification)
3234

3335
const handleExportService = useCallback(async () => {
3436
if (isExporting) {
@@ -64,8 +66,10 @@ export function useExportService({ getWorkflowId, onSuccess }: UseExportServiceP
6466
unsupportedProviders: errorData.unsupportedProviders,
6567
})
6668

67-
// Use alert for now - could be replaced with toast system
68-
alert(errorMessage)
69+
addNotification({
70+
level: 'error',
71+
message: errorMessage,
72+
})
6973
return
7074
}
7175

@@ -94,7 +98,7 @@ export function useExportService({ getWorkflowId, onSuccess }: UseExportServiceP
9498
} finally {
9599
setIsExporting(false)
96100
}
97-
}, [getWorkflowId, isExporting, onSuccess])
101+
}, [addNotification, getWorkflowId, isExporting, onSuccess])
98102

99103
return {
100104
isExporting,

0 commit comments

Comments
 (0)