@mdguggenbichler/slugbase-core 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -52,6 +52,25 @@ function SharedRedirect() {
52
52
  return <Navigate to={to} replace />;
53
53
  }
54
54
 
55
+ /** Diagnostic: catches errors in login subtree and rethrows with a prefix so cloud boundary shows where the throw came from. */
56
+ class LoginRouteErrorBoundary extends Component<{ children: ReactNode }, { error: Error | null }> {
57
+ state = { error: null as Error | null };
58
+
59
+ static getDerivedStateFromError(raw: unknown): { error: Error } {
60
+ const msg = raw instanceof Error ? raw.message : String(raw);
61
+ return { error: new Error(`[LoginRoute] ${msg || '(no message)'}`) };
62
+ }
63
+
64
+ componentDidCatch(error: unknown, info: React.ErrorInfo) {
65
+ console.error('[Login route boundary]', error, info.componentStack);
66
+ }
67
+
68
+ render() {
69
+ if (this.state.error != null) throw this.state.error;
70
+ return this.props.children;
71
+ }
72
+ }
73
+
55
74
  function AppRoutes() {
56
75
  const { user, loading } = useAuth();
57
76
  const { t } = useTranslation();
@@ -76,7 +95,7 @@ function AppRoutes() {
76
95
  return (
77
96
  <Suspense fallback={<div className="min-h-screen flex items-center justify-center"><div className="text-lg">{t('common.loading')}</div></div>}>
78
97
  <Routes>
79
- <Route path="/login" element={!user ? <Login /> : <Navigate to={appRootPath} replace />} />
98
+ <Route path="/login" element={!user ? <LoginRouteErrorBoundary><Login /></LoginRouteErrorBoundary> : <Navigate to={appRootPath} replace />} />
80
99
  <Route path="/signup" element={!user ? <Signup /> : <Navigate to={appRootPath} replace />} />
81
100
  <Route path="/reset-password" element={<PasswordReset />} />
82
101
  <Route path="/password-reset" element={<PasswordReset />} />
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mdguggenbichler/slugbase-core",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "description": "SlugBase core: backend and frontend entrypoints for self-hosted and cloud apps",
5
5
  "type": "module",
6
6
  "exports": {