fix: fix project access cache issue
This commit is contained in:
@@ -21,12 +21,6 @@ import { getCookiesFn } from '@/hooks/use-cookie-store';
|
||||
import { useSessionExtension } from '@/hooks/use-session-extension';
|
||||
import { op } from '@/utils/op';
|
||||
import type { AppRouter } from '@openpanel/trpc';
|
||||
import { createServerOnlyFn } from '@tanstack/react-start';
|
||||
import {
|
||||
getCookie,
|
||||
getCookies,
|
||||
getRequestHeaders,
|
||||
} from '@tanstack/react-start/server';
|
||||
import type { TRPCOptionsProxy } from '@trpc/tanstack-react-query';
|
||||
|
||||
op.init();
|
||||
|
||||
@@ -12,23 +12,36 @@ import {
|
||||
} from '@tanstack/react-router';
|
||||
import { format } from 'date-fns';
|
||||
|
||||
const IGNORE_ORGANIZATION_IDS = [
|
||||
'.well-known',
|
||||
'robots.txt',
|
||||
'sitemap.xml',
|
||||
'favicon.ico',
|
||||
'manifest.json',
|
||||
'sw.js',
|
||||
'service-worker.js',
|
||||
'onboarding',
|
||||
const IGNORE_ORGANIZATION_IDS = ['.well-known', 'onboarding', 'assets'];
|
||||
|
||||
const FILE_EXTENSIONS = [
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'png',
|
||||
'gif',
|
||||
'bmp',
|
||||
'tiff',
|
||||
'ico',
|
||||
'js',
|
||||
'xml',
|
||||
'txt',
|
||||
'json',
|
||||
'webmanifest',
|
||||
];
|
||||
|
||||
const isStaticFile = (path: string) => {
|
||||
return FILE_EXTENSIONS.some((extension) => path.endsWith(`.${extension}`));
|
||||
};
|
||||
|
||||
export const Route = createFileRoute('/_app/$organizationId')({
|
||||
component: Component,
|
||||
beforeLoad: async ({ context, params }) => {
|
||||
if (IGNORE_ORGANIZATION_IDS.includes(params.organizationId)) {
|
||||
throw notFound();
|
||||
}
|
||||
if (isStaticFile(params.organizationId)) {
|
||||
throw notFound();
|
||||
}
|
||||
},
|
||||
loader: async ({ context, params }) => {
|
||||
await context.queryClient.prefetchQuery(
|
||||
|
||||
Reference in New Issue
Block a user