mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 13:31:13 -05:00
Fix: Resolve React hook errors in Novu integration
This commit is contained in:
@@ -1,7 +1,14 @@
|
|||||||
import { Inbox } from '@novu/react';
|
import { lazy, Suspense } from 'react';
|
||||||
import { useNovuNotifications } from '@/hooks/useNovuNotifications';
|
import { useNovuNotifications } from '@/hooks/useNovuNotifications';
|
||||||
import { useNovuTheme } from '@/hooks/useNovuTheme';
|
import { useNovuTheme } from '@/hooks/useNovuTheme';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { Bell } from 'lucide-react';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
|
|
||||||
|
// Lazy load Novu Inbox to prevent React instance conflicts
|
||||||
|
const Inbox = lazy(() =>
|
||||||
|
import('@novu/react').then(module => ({ default: module.Inbox }))
|
||||||
|
);
|
||||||
|
|
||||||
export function NotificationCenter() {
|
export function NotificationCenter() {
|
||||||
const { applicationIdentifier, subscriberId, isEnabled } = useNovuNotifications();
|
const { applicationIdentifier, subscriberId, isEnabled } = useNovuNotifications();
|
||||||
@@ -20,11 +27,19 @@ export function NotificationCenter() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Inbox
|
<Suspense
|
||||||
applicationIdentifier={applicationIdentifier}
|
fallback={
|
||||||
subscriberId={subscriberId}
|
<Button variant="ghost" size="icon" className="h-9 w-9" disabled>
|
||||||
appearance={appearance}
|
<Bell className="h-5 w-5" />
|
||||||
onNotificationClick={handleNotificationClick}
|
</Button>
|
||||||
/>
|
}
|
||||||
|
>
|
||||||
|
<Inbox
|
||||||
|
applicationIdentifier={applicationIdentifier}
|
||||||
|
subscriberId={subscriberId}
|
||||||
|
appearance={appearance}
|
||||||
|
onNotificationClick={handleNotificationClick}
|
||||||
|
/>
|
||||||
|
</Suspense>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user