mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 01:48:12 +00:00
Add migration to widen window_duration_hours precision and update related components for duration handling
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useCallback } from 'react';
|
||||
import toast from 'react-hot-toast';
|
||||
|
||||
interface ToastOptions {
|
||||
@@ -8,7 +9,9 @@ interface ToastOptions {
|
||||
}
|
||||
|
||||
export function useToast() {
|
||||
const showToast = (options: ToastOptions) => {
|
||||
// Stable identity so callers can safely list `toast` in effect/callback deps
|
||||
// without re-firing on every render.
|
||||
const showToast = useCallback((options: ToastOptions) => {
|
||||
const { title, description, variant = 'default', duration = 3000 } = options;
|
||||
|
||||
const message = title ? `${title}${description ? ': ' + description : ''}` : description || '';
|
||||
@@ -18,7 +21,7 @@ export function useToast() {
|
||||
} else {
|
||||
toast.success(message, { duration });
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
return { toast: showToast };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user