mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-27 12:54:09 +01:00
🧩 fix: Redirect Stability and Build Chunking (#11965)
* 🔧 chore: Update Vite configuration to include additional package checks - Enhanced the Vite configuration to recognize 'dnd-core' and 'flip-toolkit' alongside existing checks for 'react-dnd' and 'react-flip-toolkit' for improved handling of React interactions. - Updated the markdown highlighting logic to also include 'lowlight' in addition to 'highlight.js' for better syntax highlighting support. * 🔧 fix: Update AuthContextProvider to prevent infinite re-fire of useEffect - Modified the dependency array of the useEffect hook in AuthContextProvider to an empty array, preventing unnecessary re-executions and potential infinite loops. Added an ESLint comment to clarify the decision regarding stable dependencies at mount. * chore: import order
This commit is contained in:
parent
09d5b1a739
commit
b01f3ccada
2 changed files with 20 additions and 8 deletions
|
|
@ -11,8 +11,8 @@ import { debounce } from 'lodash';
|
|||
import { useRecoilState } from 'recoil';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { setTokenHeader, SystemRoles } from 'librechat-data-provider';
|
||||
import type { ReactNode } from 'react';
|
||||
import type * as t from 'librechat-data-provider';
|
||||
import type { ReactNode } from 'react';
|
||||
import {
|
||||
useGetRole,
|
||||
useGetUserQuery,
|
||||
|
|
@ -167,7 +167,8 @@ const AuthContextProvider = ({
|
|||
navigate(buildLoginRedirectUrl());
|
||||
},
|
||||
});
|
||||
}, [authConfig?.test, refreshToken, setUserContext, navigate]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps -- deps are stable at mount; adding refreshToken causes infinite re-fire
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (userQuery.data) {
|
||||
|
|
|
|||
|
|
@ -8,15 +8,18 @@ import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
|||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
const backendPort = process.env.BACKEND_PORT && Number(process.env.BACKEND_PORT) || 3080;
|
||||
const backendURL = process.env.HOST ? `http://${process.env.HOST}:${backendPort}` : `http://localhost:${backendPort}`;
|
||||
const backendPort = (process.env.BACKEND_PORT && Number(process.env.BACKEND_PORT)) || 3080;
|
||||
const backendURL = process.env.HOST
|
||||
? `http://${process.env.HOST}:${backendPort}`
|
||||
: `http://localhost:${backendPort}`;
|
||||
|
||||
export default defineConfig(({ command }) => ({
|
||||
base: '',
|
||||
server: {
|
||||
allowedHosts: process.env.VITE_ALLOWED_HOSTS && process.env.VITE_ALLOWED_HOSTS.split(',') || [],
|
||||
allowedHosts:
|
||||
(process.env.VITE_ALLOWED_HOSTS && process.env.VITE_ALLOWED_HOSTS.split(',')) || [],
|
||||
host: process.env.HOST || 'localhost',
|
||||
port: process.env.PORT && Number(process.env.PORT) || 3090,
|
||||
port: (process.env.PORT && Number(process.env.PORT)) || 3090,
|
||||
strictPort: false,
|
||||
proxy: {
|
||||
'/api': {
|
||||
|
|
@ -143,7 +146,12 @@ export default defineConfig(({ command }) => ({
|
|||
if (normalizedId.includes('@dicebear')) {
|
||||
return 'avatars';
|
||||
}
|
||||
if (normalizedId.includes('react-dnd') || normalizedId.includes('react-flip-toolkit')) {
|
||||
if (
|
||||
normalizedId.includes('react-dnd') ||
|
||||
normalizedId.includes('dnd-core') ||
|
||||
normalizedId.includes('react-flip-toolkit') ||
|
||||
normalizedId.includes('flip-toolkit')
|
||||
) {
|
||||
return 'react-interactions';
|
||||
}
|
||||
if (normalizedId.includes('react-hook-form')) {
|
||||
|
|
@ -219,7 +227,10 @@ export default defineConfig(({ command }) => ({
|
|||
if (normalizedId.includes('framer-motion')) {
|
||||
return 'framer-motion';
|
||||
}
|
||||
if (normalizedId.includes('node_modules/highlight.js')) {
|
||||
if (
|
||||
normalizedId.includes('node_modules/highlight.js') ||
|
||||
normalizedId.includes('node_modules/lowlight')
|
||||
) {
|
||||
return 'markdown_highlight';
|
||||
}
|
||||
if (normalizedId.includes('katex') || normalizedId.includes('node_modules/katex')) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue