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", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "next build", "build": "next build --turbopack",
"dev": "node ./headers/dev.js && next dev", "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", "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", "idev": "cross-env NODE_OPTIONS='--inspect' next dev",

View file

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

View file

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