mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-08-23 11:36:29 +00:00
chore(frontend): silence 5 long-standing lint errors with targeted disables
Drops pnpm run lint from 5 errors to 0 (warnings unchanged at 44). Each disable is the smallest local suppression with a one-line reason on the same comment, so the next reader sees why the rule was muted: - src/components/ui/textarea.tsx (line 79): the effect intentionally syncs the internal auto-size trigger with the controlled value prop every time the parent changes it. - src/features/flows/files/use-flow-container-files.ts (line 107): the effect calls an async fetcher (fetchListing) whose setState runs after await — not synchronously inside the effect body; pathsKey is intentionally used in place of the paths array reference. - src/pages/settings/settings-prompt.tsx (line 344): the useMemo branches on data.settingsPrompts which the react-compiler can't statically prove stable. - src/providers/resources-provider.tsx (line 70): intentional mount-time loading flag for the REST hydration path. - src/providers/user-provider.tsx (line 144): refreshAuthInfo's setState runs after an async /auth/info fetch, not synchronously. Build, 475/475 vitest tests, and runtime smoke (dashboard, flows, knowledges, settings/providers) all pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
b713d6d004
commit
827fd46c81
@@ -76,6 +76,7 @@ const Textarea = React.forwardRef<TextareaRef, TextareaProps>(
|
||||
}));
|
||||
|
||||
React.useEffect(() => {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- syncs internal auto-size trigger with controlled value prop
|
||||
setTriggerAutoSize(value as string);
|
||||
}, [props?.defaultValue, value]);
|
||||
|
||||
|
||||
@@ -104,10 +104,13 @@ export const useFlowContainerFiles = ({ flowId, paths }: UseFlowContainerFilesPa
|
||||
}, [flowId, paths]);
|
||||
|
||||
useEffect(() => {
|
||||
// fetchListing is an async callback that handles its own loading state via setState
|
||||
// after await — not synchronously inside the effect body. We also depend on the
|
||||
// stable `pathsKey` instead of the array reference so identical contents don't
|
||||
// re-fire the request on every render. `flowId` triggers a fresh fetch when the
|
||||
// user switches flows.
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
void fetchListing();
|
||||
// We deliberately depend on the stable `pathsKey` instead of the array
|
||||
// reference so identical contents don't re-fire the request on every
|
||||
// render. `flowId` triggers a fresh fetch when the user switches flows.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [flowId, pathsKey]);
|
||||
|
||||
|
||||
@@ -341,6 +341,7 @@ const SettingsPrompt = () => {
|
||||
const humanTemplate = humanForm.watch('template');
|
||||
|
||||
// Determine prompt type and get prompt data
|
||||
// eslint-disable-next-line react-hooks/preserve-manual-memoization -- branching reads from data.settingsPrompts that the compiler can't statically prove stable
|
||||
const promptInfo = useMemo(() => {
|
||||
if (!promptId || !data?.settingsPrompts) {
|
||||
return null;
|
||||
|
||||
@@ -67,6 +67,7 @@ export const ResourcesProvider = ({ children }: ResourcesProviderProps) => {
|
||||
|
||||
let isCancelled = false;
|
||||
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- intentional mount-time loading flag for the REST hydration below
|
||||
setRestLoading(true);
|
||||
setRestError(null);
|
||||
|
||||
|
||||
@@ -141,6 +141,7 @@ export const UserProvider = ({ children }: { children: ReactNode }) => {
|
||||
// Refresh auth info when on login page to get fresh OAuth providers list
|
||||
useEffect(() => {
|
||||
if (location.pathname === '/login' && !isLoading) {
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect -- refreshAuthInfo's setState runs after an async fetch, not synchronously
|
||||
refreshAuthInfo();
|
||||
}
|
||||
}, [location.pathname, isLoading, refreshAuthInfo]);
|
||||
|
||||
Reference in New Issue
Block a user