mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-23 01:26:42 +02:00
♻️ refactor: centralize global error handler in shared-ui
Extract setupGlobalErrorHandler() utility from contacts app and add to @manacore/shared-ui. Migrate 7 apps to use the shared implementation: calendar, chat, clock, contacts, matrix, picture, storage. Features: - Catches unhandled promise rejections with error classification - Handles offline/online network status changes - Built-in i18n (DE + EN) with customizable translations - Optional onAuthError callback for redirect handling - Returns cleanup function for proper unmounting
This commit is contained in:
parent
aca66b2014
commit
cdac341882
11 changed files with 307 additions and 119 deletions
|
|
@ -5,24 +5,34 @@
|
|||
import { theme } from '$lib/stores/theme.svelte';
|
||||
import { authStore } from '$lib/stores/auth.svelte';
|
||||
import { waitLocale } from '$lib/i18n';
|
||||
import { ToastContainer } from '@manacore/shared-ui';
|
||||
import { ToastContainer, setupGlobalErrorHandler } from '@manacore/shared-ui';
|
||||
import { AppLoadingSkeleton } from '$lib/components/skeletons';
|
||||
|
||||
let { children } = $props();
|
||||
|
||||
let loading = $state(true);
|
||||
|
||||
onMount(async () => {
|
||||
// Wait for locale to be loaded
|
||||
await waitLocale();
|
||||
onMount(() => {
|
||||
// Setup global error handling
|
||||
const cleanupErrorHandler = setupGlobalErrorHandler();
|
||||
|
||||
// Initialize theme
|
||||
theme.initialize();
|
||||
// Initialize async operations
|
||||
const init = async () => {
|
||||
// Wait for locale to be loaded
|
||||
await waitLocale();
|
||||
|
||||
// Initialize auth
|
||||
await authStore.initialize();
|
||||
// Initialize theme
|
||||
theme.initialize();
|
||||
|
||||
loading = false;
|
||||
// Initialize auth
|
||||
await authStore.initialize();
|
||||
|
||||
loading = false;
|
||||
};
|
||||
|
||||
init();
|
||||
|
||||
return cleanupErrorHandler;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue