@mdguggenbichler/slugbase-core 0.0.18 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -65,9 +65,12 @@ export default function AdminAI() {
65
65
  }
66
66
  }, [showToast, t, adminAiOnlyToggle]);
67
67
 
68
+ // Run initial load once on mount only. Re-running when loadSettings identity changes
69
+ // (e.g. from i18n t) caused repeated API calls and infinite toasts on error.
68
70
  useEffect(() => {
69
71
  loadSettings();
70
- }, [loadSettings]);
72
+ // eslint-disable-next-line react-hooks/exhaustive-deps
73
+ }, []);
71
74
 
72
75
  const loadModels = useCallback(async () => {
73
76
  setModelsLoading(true);
@@ -1,3 +1,4 @@
1
+ import { useCallback } from 'react';
1
2
  import { toast as sonnerToast } from 'sonner';
2
3
  import { Toaster } from './sonner';
3
4
 
@@ -11,28 +12,27 @@ export interface Toast {
11
12
  }
12
13
 
13
14
  export function useToast() {
14
- const showToast = (
15
- message: string,
16
- variant: ToastVariant = 'info',
17
- duration = 3000
18
- ) => {
19
- const options = duration > 0 ? { duration } : { duration: Infinity };
20
- switch (variant) {
21
- case 'success':
22
- sonnerToast.success(message, options);
23
- break;
24
- case 'error':
25
- sonnerToast.error(message, options);
26
- break;
27
- case 'warning':
28
- sonnerToast.warning(message, options);
29
- break;
30
- case 'info':
31
- default:
32
- sonnerToast.info(message, options);
33
- break;
34
- }
35
- };
15
+ const showToast = useCallback(
16
+ (message: string, variant: ToastVariant = 'info', duration = 3000) => {
17
+ const options = duration > 0 ? { duration } : { duration: Infinity };
18
+ switch (variant) {
19
+ case 'success':
20
+ sonnerToast.success(message, options);
21
+ break;
22
+ case 'error':
23
+ sonnerToast.error(message, options);
24
+ break;
25
+ case 'warning':
26
+ sonnerToast.warning(message, options);
27
+ break;
28
+ case 'info':
29
+ default:
30
+ sonnerToast.info(message, options);
31
+ break;
32
+ }
33
+ },
34
+ []
35
+ );
36
36
 
37
37
  return { showToast };
38
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdguggenbichler/slugbase-core",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "SlugBase core: backend and frontend entrypoints for self-hosted and cloud apps",
5
5
  "type": "module",
6
6
  "exports": {