mirror of
https://github.com/inventree/InvenTree.git
synced 2026-05-12 04:28:45 +00:00
Fix lazy loading of context modals (#11911)
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import {} from '@mantine/core';
|
||||
import type { ContextModalProps } from '@mantine/modals';
|
||||
import { lazy } from 'react';
|
||||
import type { NavigateFunction } from 'react-router-dom';
|
||||
import { ScanInputHandler } from '../barcodes/BarcodeScanDialog';
|
||||
|
||||
const ScanInputHandler = lazy(() =>
|
||||
import('../barcodes/BarcodeScanDialog').then((module) => ({
|
||||
default: module.ScanInputHandler
|
||||
}))
|
||||
);
|
||||
|
||||
export function QrModal({
|
||||
context,
|
||||
|
||||
@@ -8,35 +8,16 @@ import {
|
||||
import { ModalsProvider } from '@mantine/modals';
|
||||
import { Notifications } from '@mantine/notifications';
|
||||
import { ContextMenuProvider } from 'mantine-contextmenu';
|
||||
import type { JSX } from 'react';
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
import { AboutInvenTreeModal } from '../components/modals/AboutInvenTreeModal';
|
||||
import { LicenseModal } from '../components/modals/LicenseModal';
|
||||
import { QrModal } from '../components/modals/QrModal';
|
||||
import { ServerInfoModal } from '../components/modals/ServerInfoModal';
|
||||
import { useLocalState } from '../states/LocalState';
|
||||
import { LanguageContext } from './LanguageContext';
|
||||
import { colorSchema } from './colorSchema';
|
||||
|
||||
// Lazy load the various modal dialogs - they are not needed immediately, and this can help to reduce the initial bundle size
|
||||
const AboutInvenTreeModal = lazy(() =>
|
||||
import('../components/modals/AboutInvenTreeModal').then((module) => ({
|
||||
default: module.AboutInvenTreeModal
|
||||
}))
|
||||
);
|
||||
const LicenseModal = lazy(() =>
|
||||
import('../components/modals/LicenseModal').then((module) => ({
|
||||
default: module.LicenseModal
|
||||
}))
|
||||
);
|
||||
const QrModal = lazy(() =>
|
||||
import('../components/modals/QrModal').then((module) => ({
|
||||
default: module.QrModal
|
||||
}))
|
||||
);
|
||||
const ServerInfoModal = lazy(() =>
|
||||
import('../components/modals/ServerInfoModal').then((module) => ({
|
||||
default: module.ServerInfoModal
|
||||
}))
|
||||
);
|
||||
|
||||
import { type JSX, lazy } from 'react';
|
||||
|
||||
export function ThemeContext({
|
||||
children
|
||||
}: Readonly<{ children: JSX.Element }>) {
|
||||
|
||||
Reference in New Issue
Block a user