Fix some issues

This commit is contained in:
Urtzi Alfaro
2026-01-11 19:38:54 +01:00
parent ce4f3aff8c
commit 54163843ec
17 changed files with 282 additions and 67 deletions

View File

@@ -1,9 +1,10 @@
import React, { createContext, useContext, useEffect, useRef, useState, ReactNode, useCallback } from 'react';
import { useAuthStore } from '../stores/auth.store';
import { useCurrentTenant } from '../stores/tenant.store';
import { showToast } from '../utils/toast';
import i18n from '../i18n';
import { getTenantCurrencySymbol } from '../hooks/useTenantCurrency';
// Toast notifications disabled - imports commented out
// import { showToast } from '../utils/toast';
// import i18n from '../i18n';
// import { getTenantCurrencySymbol } from '../hooks/useTenantCurrency';
interface SSEEvent {
type: string;
@@ -164,6 +165,9 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
setLastEvent(sseEvent);
// Toast notifications disabled for SSE alerts
// Code below kept for potential future re-enablement
/*
// Determine toast type based on enriched priority_level and type_class
let toastType: 'info' | 'success' | 'warning' | 'error' = 'info';
@@ -217,6 +221,7 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
}
showToast[toastType](message, { title, duration });
*/
// Trigger listeners with enriched alert data
// Wrap in queueMicrotask to prevent setState during render warnings
@@ -264,6 +269,9 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
setLastEvent(sseEvent);
// Toast notifications disabled for SSE notifications
// Code below kept for potential future re-enablement
/*
// Determine toast type based on notification priority or type
let toastType: 'info' | 'success' | 'warning' | 'error' = 'info';
@@ -341,6 +349,7 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
const duration = data.priority_level === 'critical' ? 0 : 5000;
showToast[toastType](message, { title, duration });
*/
// Trigger listeners with notification data
// Wrap in queueMicrotask to prevent setState during render warnings
@@ -383,6 +392,9 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
setLastEvent(sseEvent);
// Toast notifications disabled for SSE recommendations
// Code below kept for potential future re-enablement
/*
// Recommendations are typically positive insights
let toastType: 'info' | 'success' | 'warning' | 'error' = 'info';
@@ -458,6 +470,7 @@ export const SSEProvider: React.FC<SSEProviderProps> = ({ children }) => {
const duration = 5000; // Recommendations are typically informational
showToast[toastType](message, { title, duration });
*/
// Trigger listeners with recommendation data
// Wrap in queueMicrotask to prevent setState during render warnings