Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: CI (#16504)

Lynnb53b693f2259
diff --git a/lefthook.yml b/lefthook.yml
index e709592238..53168f5ac7 100644
--- a/lefthook.yml
+++ b/lefthook.yml
@@ -39,9 +39,36 @@ pre-commit:
stage_fixed: true
- name: web-prettier
glob: "web/**/*.{css,less,json,js,jsx,ts,tsx}"
- run: npx --prefix web prettier --write --ignore-unknown {staged_files}
+ run: |
+ # Ensure web/node_modules is populated. CI runners don't run `npm install`
+ # before lefthook, and `npx` without local node_modules fetches the
+ # latest packages from the registry — which breaks because the pinned
+ # prettier plugins (prettier-plugin-organize-imports,
+ # prettier-plugin-packagejson) aren't auto-resolved and ESLint 10
+ # requires eslint.config.js.
+ # Use a mkdir-based mutex to prevent parallel npm ci from multiple hooks
+ # racing (ETXTBSY error on esbuild). mkdir is atomic on both Linux and macOS.
+ LOCKDIR=/tmp/ragflow-web-npm-lock
+ while ! mkdir "$LOCKDIR" 2>/dev/null; do sleep 0.5; done
+ if [ ! -f web/node_modules/.package-lock.json ]; then
+ echo "==> web/node_modules missing or incomplete; running npm ci --prefix web"
+ rm -rf web/node_modules
+ npm ci --prefix web --no-audit --no-fund || { rm -rf "$LOCKDIR"; exit 1; }
+ fi
+ rm -rf "$LOCKDIR"
+ cd web && printf '%s\n' {staged_files} | sed 's|^web/||' | xargs npx prettier --write --ignore-unknown
stage_fixed: true
- name: web-eslint
glob: "web/**/*.{js,jsx,ts,tsx}"
- run: npx --prefix web eslint --fix {staged_files}
+ run: |
+ # Same npm ci guard as web-prettier; mkdir mutex serialises concurrent installs.
+ LOCKDIR=/tmp/ragflow-web-npm-lock
+ while ! mkdir "$LOCKDIR" 2>/dev/null; do sleep 0.5; done
+ if [ ! -f web/node_modules/.package-lock.json ]; then
+ echo "==> web/node_modules missing or incomplete; running npm ci --prefix web"
+ rm -rf web/node_modules
+ npm ci --prefix web --no-audit --no-fund || { rm -rf "$LOCKDIR"; exit 1; }
+ fi
+ rm -rf "$LOCKDIR"
+ cd web && printf '%s\n' {staged_files} | sed 's|^web/||' | xargs npx eslint --fix
stage_fixed: true
diff --git a/web/src/components/ui/modal/modal.tsx b/web/src/components/ui/modal/modal.tsx
index 738bc0edde..6f5e74b94d 100644
--- a/web/src/components/ui/modal/modal.tsx
+++ b/web/src/components/ui/modal/modal.tsx
@@ -1,7 +1,8 @@
+// src/components/ui/modal.tsx
+import React, { FC, ReactNode, useCallback, useEffect, useMemo } from 'react';
import { cn } from '@/lib/utils';
import * as DialogPrimitive from '@radix-ui/react-dialog';
import { AlertCircle, CheckCircle, Info, Loader, X } from 'lucide-react';
-import React, { FC, ReactNode, useCallback, useEffect, useMemo } from 'react';
import { createRoot } from 'react-dom/client';
import { useTranslation } from 'react-i18next';
import { DialogDescription } from '../dialog';