mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 09:16:46 +00:00
Changes
Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
parent
fa8bee0e36
commit
104dd8af7e
12 changed files with 1428 additions and 50 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { createRouter, useRouter } from "@tanstack/react-router";
|
||||
import { QueryClient } from "@tanstack/react-query";
|
||||
import { routeTree } from "./routeTree.gen";
|
||||
|
||||
function DefaultErrorComponent({ error, reset }: { error: Error; reset: () => void }) {
|
||||
|
|
@ -23,9 +24,9 @@ function DefaultErrorComponent({ error, reset }: { error: Error; reset: () => vo
|
|||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<h1 className="text-2xl font-bold tracking-tight text-foreground">Something went wrong</h1>
|
||||
<h1 className="text-2xl font-bold tracking-tight text-foreground">Algo deu errado</h1>
|
||||
<p className="mt-2 text-sm text-muted-foreground">
|
||||
An unexpected error occurred. Please try again.
|
||||
Ocorreu um erro inesperado. Tente novamente.
|
||||
</p>
|
||||
{import.meta.env.DEV && error.message && (
|
||||
<pre className="mt-4 max-h-40 overflow-auto rounded-md bg-muted p-3 text-left font-mono text-xs text-destructive">
|
||||
|
|
@ -38,15 +39,15 @@ function DefaultErrorComponent({ error, reset }: { error: Error; reset: () => vo
|
|||
router.invalidate();
|
||||
reset();
|
||||
}}
|
||||
className="inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90"
|
||||
className="inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary-dark"
|
||||
>
|
||||
Try again
|
||||
Tentar novamente
|
||||
</button>
|
||||
<a
|
||||
href="/"
|
||||
className="inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:bg-accent"
|
||||
>
|
||||
Go home
|
||||
Ir para o início
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -55,9 +56,20 @@ function DefaultErrorComponent({ error, reset }: { error: Error; reset: () => vo
|
|||
}
|
||||
|
||||
export const getRouter = () => {
|
||||
// Fresh QueryClient per request — never module-level (vaza dados entre SSR requests)
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
staleTime: 30_000,
|
||||
retry: 1,
|
||||
refetchOnWindowFocus: false,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const router = createRouter({
|
||||
routeTree,
|
||||
context: {},
|
||||
context: { queryClient },
|
||||
scrollRestoration: true,
|
||||
defaultPreloadStaleTime: 0,
|
||||
defaultErrorComponent: DefaultErrorComponent,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue