Added update dynamic imports

This commit is contained in:
Nate Kelley 2025-10-07 22:54:25 -06:00
parent 8901b99bb8
commit c434ecde65
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
12 changed files with 36 additions and 36 deletions

View File

@ -1,6 +1,12 @@
import { lazy, Suspense } from 'react';
import { ErrorBoundary } from 'react-error-boundary';
import { apiErrorHandler } from '@/api/errors';
import { ErrorCard } from './GlobalErrorCard';
const ErrorCard = lazy(() =>
import('./GlobalErrorCard').then((module) => ({
default: module.ErrorCard,
}))
);
export const ComponentErrorCard = ({
children,
@ -15,7 +21,11 @@ export const ComponentErrorCard = ({
<ErrorBoundary
fallbackRender={(e) => {
const errorMessage: string | undefined = apiErrorHandler(e).message || undefined;
return <ErrorCard header={header} message={errorMessage || message} />;
return (
<Suspense fallback={<div />}>
<ErrorCard header={header} message={errorMessage || message} />
</Suspense>
);
}}
>
{children}

View File

@ -131,7 +131,7 @@ export const GlobalSearchModalFilters = React.memo(
}
}}
>
<Tooltip title="Filters">
<Tooltip title="Filters" sideOffset={10} side="top">
<Button
variant={'ghost'}
prefix={<BarsFilter />}

View File

@ -1,5 +1,3 @@
'use client';
import { DEFAULT_CHART_THEME } from '@buster/server-shared/metrics';
import {
ArcElement,
@ -25,15 +23,10 @@ import {
} from 'chart.js';
import ChartJsAnnotationPlugin from 'chartjs-plugin-annotation';
import ChartDataLabels from 'chartjs-plugin-datalabels';
import ChartDeferred from 'chartjs-plugin-deferred';
import { truncateText } from '@/lib/text';
import { isServer } from '@/lib/window';
import { ChartMountedPlugin } from './core/plugins';
import { ChartMountedPlugin } from './core/plugins/chartjs-plugin-mounted';
import ChartTrendlinePlugin from './core/plugins/chartjs-plugin-trendlines';
import './core/plugins/chartjs-plugin-dayjs';
import './core/plugins/chartjs-scale-tick-duplicate';
import './core/plugins/chartjs-plugin-trendlines';
import { timeout } from '@/lib/timeout';
ChartJS.register(
LineController,

View File

@ -1,4 +1,5 @@
export * from './chartjs-plugin-dayjs';
// Note: chartjs-plugin-dayjs is dynamically imported in ChartJSTheme.ts setupChartJS()
// and should not be statically exported here to avoid Vite warnings
export * from './chartjs-plugin-hover-bar';
export * from './chartjs-plugin-hover-line';
export * from './chartjs-plugin-hover-scatter';

View File

@ -1,5 +1,3 @@
'use client';
import * as ToolbarPrimitive from '@radix-ui/react-toolbar';
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
import { cva, type VariantProps } from 'class-variance-authority';

View File

@ -2,9 +2,9 @@ import type { AssetType } from '@buster/server-shared/assets';
import type { QueryClient } from '@tanstack/react-query';
import { Outlet, useRouteContext } from '@tanstack/react-router';
import omit from 'lodash/omit';
import { lazy, Suspense } from 'react';
import { prefetchGetChat } from '@/api/buster_rest/chats';
import { getAppLayout } from '@/api/server-functions/getAppLayout';
import { ErrorCard } from '@/components/features/global/GlobalErrorCard';
import {
chooseInitialLayout,
getDefaultLayout,
@ -12,6 +12,12 @@ import {
} from '@/context/Chats/selected-mode-helpers';
import { ChatLayout } from '@/layouts/ChatLayout/ChatLayout';
const ErrorCard = lazy(() =>
import('@/components/features/global/GlobalErrorCard').then((module) => ({
default: module.ErrorCard,
}))
);
export const beforeLoad = async ({
params,
context,
@ -81,10 +87,12 @@ export const component = () => {
if (!initialLayout || !selectedLayout || !autoSaveId || !defaultLayout) {
return (
<ErrorCard
header="Hmmm... Something went wrong."
message="An error occurred while loading the chat."
/>
<Suspense fallback={<div />}>
<ErrorCard
header="Hmmm... Something went wrong."
message="An error occurred while loading the chat."
/>
</Suspense>
);
}

View File

@ -1,5 +1,3 @@
'use client';
import type { DataResult } from '@buster/server-shared/metrics';
import isEmpty from 'lodash/isEmpty';
import type React from 'react';

View File

@ -1,5 +1,3 @@
'use client';
import React, { useState } from 'react';
import { useDatasetListDatasetGroups } from '@/api/buster_rest/datasets';
import {

View File

@ -1,5 +1,3 @@
'use client';
import type React from 'react';
import { useMemo, useState } from 'react';
import type { ListDatasetGroupsResponse } from '@/api/asset_interfaces';

View File

@ -1,5 +1,3 @@
'use client';
import React from 'react';
import { useGetDatasetPermissionsOverview } from '@/api/buster_rest/datasets';
import {

View File

@ -1,5 +1,3 @@
'use client';
import React, { useMemo } from 'react';
import type { DatasetPermissionOverviewUser } from '@/api/asset_interfaces';
import { ListUserItem } from '@/components/features/list/ListUserItem';

View File

@ -37,23 +37,23 @@ const config = defineConfig(({ command, mode }) => {
plugins: [
// this is the plugin that enables path aliases
tsConfigPaths({ projects: ['./tsconfig.json'] }),
tailwindcss(),
tanstackStart(),
nitroV2Plugin({
preset: isLocalBuild && !isVercelBuild ? 'bun' : 'node-server',
}),
viteReact(),
useChecker
? checker({
typescript: isTypecheck,
biome: isProduction,
})
: undefined,
tailwindcss(),
tanstackStart(),
nitroV2Plugin({
preset: isLocalBuild && !isVercelBuild ? 'bun' : 'node-server',
}),
viteReact(),
],
worker: { format: 'es' },
build: {
chunkSizeWarningLimit: 1500,
reportCompressedSize: true, // Disable gzip size reporting to speed up build
reportCompressedSize: false, // Disable gzip size reporting to speed up build
rollupOptions: {
// Exclude test and stories files from build
external: (id) => {