Skip to content

Commit

Permalink
Merge pull request #156 from r00tat/bugfix/empty-group-assignment
Browse files Browse the repository at this point in the history
Bugfix empty group assignment
  • Loading branch information
r00tat authored Sep 29, 2024
2 parents af35e79 + a43bc3b commit c36ecec
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 2 deletions.
32 changes: 32 additions & 0 deletions src/app/error.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<div>
<h2>Something went wrong!</h2>
<button
onClick={
// Attempt to recover by trying to re-render the segment
() => reset()
}
>
Try again
</button>
</div>
);
}
28 changes: 28 additions & 0 deletions src/app/global-error.tsx
Original file line number Diff line number Diff line change
@@ -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
<html>
<body>
<h2>Something went wrong!</h2>
<button onClick={() => reset()}>Try again</button>
</body>
</html>
);
}
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useFirebaseLoginObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c36ecec

Please sign in to comment.