test with turbo

This commit is contained in:
Marco Pedone 2025-08-28 13:46:51 +02:00
parent 5a6f23b4e8
commit f0881a062f
3 changed files with 9 additions and 3 deletions

View file

@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"build": "next build",
"build": "next build --turbopack",
"dev": "node ./headers/dev.js && next dev",
"dev-https": "node ./headers/dev-https.js && cross-env NEXT_PUBLIC_BASE_URL='https://localhost:3000' INTERNAL_BASE_URL='https://localhost:3000' next dev --experimental-https",
"idev": "cross-env NODE_OPTIONS='--inspect' next dev",

View file

@ -27,6 +27,8 @@ export const SessionProvider: FC<{ children: ReactNode }> = ({ children }) => {
data: user,
status,
isLoading,
isError,
error,
} = api.auth.getSession.useQuery(undefined, {
refetchOnWindowFocus: true,
refetchOnReconnect: true,
@ -35,6 +37,10 @@ export const SessionProvider: FC<{ children: ReactNode }> = ({ children }) => {
refetchInterval: 30000,
});
if (isError && error) {
console.error("Session fetch error: ", error);
}
// Invalidate session on route change
useEffect(() => {
const handleRouteChange = () => {

View file

@ -50,8 +50,8 @@ export const api = createTRPCNext<AppRouter>({
errorLink,
loggerLink({
enabled: (opts) =>
(process.env.NODE_ENV === "development" &&
typeof window !== "undefined") ||
//(process.env.NODE_ENV === "development" &&
typeof window !== "undefined" /* ) */ ||
(opts.direction === "down" && opts.result instanceof Error),
}),