create-mercato-app 0.6.6-develop.6094.1.28b081ea16 → 0.6.6-develop.6121.1.5797a901b3
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.
package/package.json
CHANGED
package/template/next.config.ts
CHANGED
|
@@ -9,6 +9,13 @@ const nextConfig: NextConfig = {
|
|
|
9
9
|
experimental: {
|
|
10
10
|
serverMinification: false,
|
|
11
11
|
turbopackMinify: false,
|
|
12
|
+
// Mirror apps/mercato: treat these barrel-heavy packages as having
|
|
13
|
+
// modularized exports so only the named exports actually used are
|
|
14
|
+
// evaluated. Keeps scaffolded apps on the same client-bundle baseline.
|
|
15
|
+
// - lucide-react: icons used across the default backend components.
|
|
16
|
+
// - recharts: pairs with the next/dynamic chart split in @open-mercato/ui.
|
|
17
|
+
// - date-fns: already deep-imported; listed here as defense-in-depth.
|
|
18
|
+
optimizePackageImports: ['lucide-react', 'recharts', 'date-fns'],
|
|
12
19
|
...(isDevelopment
|
|
13
20
|
? {
|
|
14
21
|
preloadEntriesOnStart: false,
|
|
@@ -79,6 +79,22 @@ describe('GlobalError component', () => {
|
|
|
79
79
|
expect(reloadMock).not.toHaveBeenCalled()
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
+
it('renders with design-system tokens and the shared Button primitive', () => {
|
|
83
|
+
setOnLine(true)
|
|
84
|
+
const reset = jest.fn()
|
|
85
|
+
const err = Object.assign(new Error('boom'), { name: 'TypeError' })
|
|
86
|
+
render(<GlobalError error={err} reset={reset} />)
|
|
87
|
+
const alert = screen.getByRole('alert')
|
|
88
|
+
const button = screen.getByRole('button', { name: /try again/i })
|
|
89
|
+
|
|
90
|
+
expect(alert).toHaveClass('bg-background', 'text-foreground')
|
|
91
|
+
expect(alert).not.toHaveAttribute('style')
|
|
92
|
+
expect(screen.getByRole('heading', { level: 1 })).not.toHaveAttribute('style')
|
|
93
|
+
expect(screen.getByText(/unexpected error occurred/i)).not.toHaveAttribute('style')
|
|
94
|
+
expect(button).toHaveAttribute('data-slot', 'button')
|
|
95
|
+
expect(button).not.toHaveAttribute('style')
|
|
96
|
+
})
|
|
97
|
+
|
|
82
98
|
it('renders offline UI for ChunkLoadError even when navigator reports online', () => {
|
|
83
99
|
setOnLine(true)
|
|
84
100
|
const reset = jest.fn()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
|
+
import { Button } from '@open-mercato/ui/primitives/button'
|
|
3
4
|
import { useEffect, useState } from 'react'
|
|
4
5
|
import { reloadPage } from './global-error-reload'
|
|
5
6
|
|
|
@@ -53,6 +54,7 @@ export default function GlobalError({ error, reset }: GlobalErrorProps) {
|
|
|
53
54
|
}, [networkError])
|
|
54
55
|
|
|
55
56
|
const showOfflineView = networkError || isOffline
|
|
57
|
+
// Next.js global-error renders outside normal app providers, so these are provider-independent fallback strings.
|
|
56
58
|
const title = showOfflineView ? 'You appear to be offline' : 'Something went wrong'
|
|
57
59
|
const description = showOfflineView
|
|
58
60
|
? 'Unable to connect. Please check your internet connection and try again. This page will reload automatically when your connection is restored.'
|
|
@@ -67,36 +69,20 @@ export default function GlobalError({ error, reset }: GlobalErrorProps) {
|
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
return (
|
|
70
|
-
<html>
|
|
71
|
-
<body>
|
|
72
|
+
<html className="bg-background text-foreground">
|
|
73
|
+
<body className="bg-background text-foreground">
|
|
72
74
|
<main
|
|
73
75
|
role="alert"
|
|
74
76
|
aria-live="assertive"
|
|
75
|
-
|
|
76
|
-
padding: '2rem',
|
|
77
|
-
fontFamily: 'system-ui, -apple-system, sans-serif',
|
|
78
|
-
maxWidth: '36rem',
|
|
79
|
-
margin: '4rem auto',
|
|
80
|
-
}}
|
|
77
|
+
className="flex min-h-screen items-start justify-center bg-background px-6 py-16 text-foreground"
|
|
81
78
|
>
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
type="button"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
fontSize: '1rem',
|
|
90
|
-
fontWeight: 500,
|
|
91
|
-
background: '#111827',
|
|
92
|
-
color: '#ffffff',
|
|
93
|
-
border: 'none',
|
|
94
|
-
borderRadius: '0.375rem',
|
|
95
|
-
cursor: 'pointer',
|
|
96
|
-
}}
|
|
97
|
-
>
|
|
98
|
-
{buttonLabel}
|
|
99
|
-
</button>
|
|
79
|
+
<div className="w-full max-w-xl space-y-4 rounded-lg border border-border bg-card p-6 shadow-sm">
|
|
80
|
+
<h1 className="text-2xl font-bold tracking-tight">{title}</h1>
|
|
81
|
+
<p className="text-sm leading-6 text-muted-foreground">{description}</p>
|
|
82
|
+
<Button type="button" onClick={handleRetry}>
|
|
83
|
+
{buttonLabel}
|
|
84
|
+
</Button>
|
|
85
|
+
</div>
|
|
100
86
|
</main>
|
|
101
87
|
</body>
|
|
102
88
|
</html>
|