From 2a06e65dd95b25e68bff601db8a8073fd5deb85d Mon Sep 17 00:00:00 2001 From: Paul Woelfel Date: Sun, 29 Sep 2024 22:58:10 +0200 Subject: [PATCH 1/2] Add special allUsers group --- src/hooks/useFirebaseLoginObserver.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/useFirebaseLoginObserver.ts b/src/hooks/useFirebaseLoginObserver.ts index 2236dba..f0cfe80 100644 --- a/src/hooks/useFirebaseLoginObserver.ts +++ b/src/hooks/useFirebaseLoginObserver.ts @@ -55,7 +55,7 @@ export default function useFirebaseLoginObserver(): LoginStatus { isAdmin: prev.isAdmin || userData?.isAdmin === true, messagingTokens: userData.messaging, chatNotifications: userData.chatNotifications, - groups: userData.groups || [], + groups: [...(userData.groups || []), 'allUsers'], isRefreshing: false, })); } else { From a43bc3b95b26038b3ffb0c4d55d9ff3da1e627d0 Mon Sep 17 00:00:00 2001 From: Paul Woelfel Date: Sun, 29 Sep 2024 23:04:34 +0200 Subject: [PATCH 2/2] Add error boundaries --- src/app/error.tsx | 32 ++++++++++++++++++++++++++++++++ src/app/global-error.tsx | 28 ++++++++++++++++++++++++++++ src/app/layout.tsx | 2 +- 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 src/app/error.tsx create mode 100644 src/app/global-error.tsx diff --git a/src/app/error.tsx b/src/app/error.tsx new file mode 100644 index 0000000..fa9ad3e --- /dev/null +++ b/src/app/error.tsx @@ -0,0 +1,32 @@ +'use client'; // Error boundaries must be Client Components + +// see https://nextjs.org/docs/app/building-your-application/routing/error-handling#uncaught-exceptions + +import { useEffect } from 'react'; + +export default function Error({ + error, + reset, +}: { + error: Error & { digest?: string }; + reset: () => void; +}) { + useEffect(() => { + // Log the error to an error reporting service + console.error('Failed to render: ', error); + }, [error]); + + return ( +
+

Something went wrong!

+ +
+ ); +} diff --git a/src/app/global-error.tsx b/src/app/global-error.tsx new file mode 100644 index 0000000..91a1aea --- /dev/null +++ b/src/app/global-error.tsx @@ -0,0 +1,28 @@ +'use client'; +import { useEffect } from 'react'; + +// Error boundaries must be Client Components +// see https://nextjs.org/docs/app/building-your-application/routing/error-handling#uncaught-exceptions + +export default function GlobalError({ + error, + reset, +}: { + error: Error & { digest?: string }; + reset: () => void; +}) { + useEffect(() => { + // Log the error to an error reporting service + console.error('Global Error: ', error); + }, [error]); + + return ( + // global-error must include html and body tags + + +

Something went wrong!

+ + + + ); +} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index beeb1ab..4cf301b 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,8 +1,8 @@ +import 'leaflet/dist/leaflet.css'; import type { Metadata, Viewport } from 'next'; import React from 'react'; import AppProviders from '../components/providers/AppProviders'; import '../styles/globals.css'; -import 'leaflet/dist/leaflet.css'; const APP_NAME = 'Einsatzkarte FFN'; const APP_DEFAULT_TITLE = 'Einsatzkarte FFN';