mirror of https://github.com/buster-so/buster.git
Make query cache a little faster
This commit is contained in:
parent
b95f952166
commit
f544d93d6b
|
@ -94,12 +94,12 @@ const nextConfig = {
|
|||
transpilePackages: ['shiki'],
|
||||
// ESLint configuration
|
||||
eslint: {
|
||||
ignoreDuringBuilds: false,
|
||||
ignoreDuringBuilds: process.env.NEXT_DISABLE_LINT === 'true' || process.env.CI === 'true',
|
||||
dirs: ['src']
|
||||
},
|
||||
// Disable TypeScript type checking during builds
|
||||
typescript: {
|
||||
ignoreBuildErrors: false
|
||||
ignoreBuildErrors: process.env.NEXT_DISABLE_TS_CHECK === 'true'
|
||||
},
|
||||
sassOptions: {
|
||||
includePaths: [path.join(__dirname, 'styles')],
|
||||
|
|
|
@ -7,7 +7,6 @@ import './MonacoWebWorker';
|
|||
|
||||
import type { editor } from 'monaco-editor/esm/vs/editor/editor.api';
|
||||
import React, { forwardRef, useMemo } from 'react';
|
||||
import { useMemoizedFn } from '@/hooks';
|
||||
import { cn } from '@/lib/classMerge';
|
||||
import { CircleSpinnerLoaderContainer } from '../../loaders/CircleSpinnerLoaderContainer';
|
||||
import { configureMonacoToUseYaml } from './yamlHelper';
|
||||
|
@ -16,9 +15,14 @@ import { configureMonacoToUseYaml } from './yamlHelper';
|
|||
//import NightOwnTheme from 'monaco-themes/themes/Night Owl.json';
|
||||
//https://github.com/brijeshb42/monaco-ace-tokenizer
|
||||
|
||||
import { Editor } from '@monaco-editor/react';
|
||||
import { useTheme } from 'next-themes';
|
||||
|
||||
import dynamic from 'next/dynamic';
|
||||
const Editor = dynamic(() => import('@monaco-editor/react').then((m) => m.Editor), {
|
||||
ssr: false,
|
||||
loading: () => null
|
||||
});
|
||||
|
||||
interface AppCodeEditorProps {
|
||||
className?: string;
|
||||
onChangeEditorHeight?: (height: number) => void;
|
||||
|
@ -103,8 +107,10 @@ export const AppCodeEditor = forwardRef<AppCodeEditorHandle, AppCodeEditorProps>
|
|||
};
|
||||
}, [readOnlyMessage, monacoEditorOptions]);
|
||||
|
||||
const onMountCodeEditor = useMemoizedFn(
|
||||
async (editor: editor.IStandaloneCodeEditor, monaco: typeof import('monaco-editor')) => {
|
||||
const onMountCodeEditor = async (
|
||||
editor: editor.IStandaloneCodeEditor,
|
||||
monaco: typeof import('monaco-editor')
|
||||
) => {
|
||||
const [GithubLightTheme, NightOwlTheme] = await Promise.all([
|
||||
(await import('./themes/github_light_theme')).default,
|
||||
(await import('./themes/tomorrow_night_theme')).default
|
||||
|
@ -132,14 +138,13 @@ export const AppCodeEditor = forwardRef<AppCodeEditorHandle, AppCodeEditorProps>
|
|||
editor.addCommand(monaco.KeyMod.CtrlCmd | monaco.KeyCode.Enter, () => {
|
||||
onMetaEnter?.();
|
||||
});
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
const onChangeCodeEditor = useMemoizedFn((v: string | undefined) => {
|
||||
const onChangeCodeEditor = (v: string | undefined) => {
|
||||
if (!readOnly) {
|
||||
onChange?.(v || '');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
|
@ -72,13 +72,6 @@ export const getCodeTokens = async (
|
|||
});
|
||||
};
|
||||
|
||||
// Pre-initialize highlighter on module load for better performance
|
||||
if (typeof window !== 'undefined') {
|
||||
initializeHighlighter().catch((error) => {
|
||||
console.warn('Failed to pre-initialize syntax highlighter:', error);
|
||||
});
|
||||
}
|
||||
|
||||
export const getFallbackStyle = (isDarkMode: boolean) => {
|
||||
return {
|
||||
background: isDarkMode ? githubDark.bg : githubLight.bg,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import { z } from 'zod';
|
||||
import { isServer } from '@tanstack/react-query';
|
||||
|
||||
const isServer = typeof window === 'undefined';
|
||||
|
||||
if (!isServer) {
|
||||
throw new Error('env.mjs is only meant to be used on the server');
|
||||
|
|
|
@ -20,6 +20,7 @@ function makeQueryClient(params?: {
|
|||
defaultOptions: {
|
||||
queries: {
|
||||
refetchOnWindowFocus: false,
|
||||
retryDelay: ERROR_RETRY_DELAY,
|
||||
staleTime: PREFETCH_STALE_TIME,
|
||||
gcTime: GC_TIME,
|
||||
enabled: () => {
|
||||
|
@ -31,8 +32,7 @@ function makeQueryClient(params?: {
|
|||
params.openErrorNotification(error);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
retryDelay: ERROR_RETRY_DELAY
|
||||
}
|
||||
},
|
||||
mutations: {
|
||||
retry: (failureCount, error) => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export const PREFETCH_STALE_TIME = 1000 * 10; // 10 seconds
|
||||
export const PREFETCH_STALE_TIME = 1000 * 60 * 1; // 1 minutes
|
||||
export const ERROR_RETRY_DELAY = 1 * 1000; // 1 second delay after error
|
||||
export const GC_TIME = 1000 * 60 * 60 * 24 * 3; // 3 days - matches persistence duration
|
||||
export const GC_TIME = 1000 * 60 * 5; // 5 minutes - matches new persistence duration
|
||||
export const USER_CANCELLED_ERROR = new Error('User cancelled');
|
||||
|
|
Loading…
Reference in New Issue