fix: lint error

This commit is contained in:
moxi
2026-01-04 00:04:36 +08:00
parent 42eb783395
commit 334d75f2dd
4 changed files with 37 additions and 19 deletions

View File

@@ -7,7 +7,7 @@
"dev": "vite", "dev": "vite",
"build": "tsc && vite build", "build": "tsc && vite build",
"preview": "vite preview", "preview": "vite preview",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives",
"format": "prettier --write \"src/**/*.{ts,tsx,css,scss}\"", "format": "prettier --write \"src/**/*.{ts,tsx,css,scss}\"",
"type-check": "tsc --noEmit" "type-check": "tsc --noEmit"
}, },

View File

@@ -69,17 +69,27 @@ export function PageTransition({
: toIndex > fromIndex : toIndex > fromIndex
? 'forward' ? 'forward'
: 'backward'; : 'backward';
setTransitionDirection(nextDirection);
setLayers((prev) => { let cancelled = false;
const prevCurrent = prev[prev.length - 1];
return [ queueMicrotask(() => {
prevCurrent if (cancelled) return;
? { ...prevCurrent, status: 'exiting' } setTransitionDirection(nextDirection);
: { key: location.key, location, status: 'exiting' }, setLayers((prev) => {
{ key: location.key, location, status: 'current' }, const prevCurrent = prev[prev.length - 1];
]; return [
prevCurrent
? { ...prevCurrent, status: 'exiting' }
: { key: location.key, location, status: 'exiting' },
{ key: location.key, location, status: 'current' },
];
});
setIsAnimating(true);
}); });
setIsAnimating(true);
return () => {
cancelled = true;
};
}, [ }, [
isAnimating, isAnimating,
location, location,

View File

@@ -114,7 +114,7 @@ export function QuotaSection<TState extends QuotaStatusState, TData>({
const filteredFiles = useMemo(() => files.filter((file) => config.filterFn(file)), [ const filteredFiles = useMemo(() => files.filter((file) => config.filterFn(file)), [
files, files,
config.filterFn config
]); ]);
const { const {
@@ -126,7 +126,6 @@ export function QuotaSection<TState extends QuotaStatusState, TData>({
goToPrev, goToPrev,
goToNext, goToNext,
loading: sectionLoading, loading: sectionLoading,
loadingScope,
setLoading setLoading
} = useQuotaPagination(filteredFiles); } = useQuotaPagination(filteredFiles);

View File

@@ -54,19 +54,28 @@ export function Modal({ open, title, onClose, footer, width = 520, children }: P
); );
useEffect(() => { useEffect(() => {
let cancelled = false;
if (open) { if (open) {
if (closeTimerRef.current !== null) { if (closeTimerRef.current !== null) {
window.clearTimeout(closeTimerRef.current); window.clearTimeout(closeTimerRef.current);
closeTimerRef.current = null; closeTimerRef.current = null;
} }
setIsVisible(true); queueMicrotask(() => {
setIsClosing(false); if (cancelled) return;
return; setIsVisible(true);
setIsClosing(false);
});
} else if (isVisible) {
queueMicrotask(() => {
if (cancelled) return;
startClose(false);
});
} }
if (isVisible) { return () => {
startClose(false); cancelled = true;
} };
}, [open, isVisible, startClose]); }, [open, isVisible, startClose]);
const handleClose = useCallback(() => { const handleClose = useCallback(() => {