Next.js 16, React 19.2, Identities page, Invitations identities step, PNPM Catalogs (#381)

* Upgraded to Next.js 16
* Refactored code to comply with React 19.2 ESLint rules
* Refactored some useEffect usages with the new useEffectEvent
* Added Identities page and added second step to set up an identity after accepting an invitation
* Updated all dependencies
* Introduced PNPM catalogs for some frequently updated dependencies
* Bugs fixing and improvements
This commit is contained in:
Giancarlo Buomprisco
2025-10-22 11:47:47 +09:00
committed by GitHub
parent ea0c1dde80
commit 2c0d0bf7a1
98 changed files with 4812 additions and 4394 deletions

View File

@@ -1,6 +1,6 @@
'use client';
import { useCallback, useEffect } from 'react';
import { useCallback, useEffect, useEffectEvent } from 'react';
import { usePathname, useSearchParams } from 'next/navigation';
@@ -28,19 +28,38 @@ function useAnalyticsMapping<T extends ConsumerProvidedEventTypes>(
) {
const appEvents = useAppEvents<T>();
const subscribeToAppEvent = useEffectEvent(
(
eventType: AppEventType<T>,
handler: (event: AppEvent<T, AppEventType<T>>) => unknown,
) => {
appEvents.on(eventType, handler);
},
);
const unsubscribeFromAppEvent = useEffectEvent(
(
eventType: AppEventType<T>,
handler: (event: AppEvent<T, AppEventType<T>>) => unknown,
) => {
appEvents.off(eventType, handler);
},
);
useEffect(() => {
const subscriptions = Object.entries(mapping).map(
([eventType, handler]) => {
appEvents.on(eventType as AppEventType<T>, handler);
subscribeToAppEvent(eventType as AppEventType<T>, handler);
return () => appEvents.off(eventType as AppEventType<T>, handler);
return () =>
unsubscribeFromAppEvent(eventType as AppEventType<T>, handler);
},
);
return () => {
subscriptions.forEach((unsubscribe) => unsubscribe());
};
}, [appEvents, mapping]);
}, [mapping]);
}
/**
@@ -96,9 +115,14 @@ function useReportPageView(reportAnalyticsFn: (url: string) => unknown) {
const pathname = usePathname();
const searchParams = useSearchParams();
useEffect(() => {
const callAnalyticsOnPathChange = useEffectEvent(() => {
const url = [pathname, searchParams.toString()].filter(Boolean).join('?');
reportAnalyticsFn(url);
}, [pathname, reportAnalyticsFn, searchParams]);
return reportAnalyticsFn(url);
});
useEffect(() => {
callAnalyticsOnPathChange();
// call whenever the pathname changes
}, [pathname]);
}

View File

@@ -8,8 +8,6 @@ import { useMonitoring } from '@kit/monitoring/hooks';
import { useAppEvents } from '@kit/shared/events';
import { useAuthChangeListener } from '@kit/supabase/hooks/use-auth-change-listener';
import pathsConfig from '~/config/paths.config';
export function AuthProvider(props: React.PropsWithChildren) {
const dispatchEvent = useDispatchAppEventFromAuthEvent();
@@ -23,7 +21,6 @@ export function AuthProvider(props: React.PropsWithChildren) {
);
useAuthChangeListener({
appHomePath: pathsConfig.app.home,
onEvent,
});