Repository navigation
webui: clean up exhaustive-deps TODOs in auth, config and file renderers - #10607
shaktimaan00 wants to merge 2 commits into
Conversation
Goes through the eslint-disable spots left by the exhaustive-deps rollout and resolves each one instead of leaving the TODO in place. - authContext: refreshUser now flips to PENDING with a functional setStatus update so it doesn't need 'status' in its closure, and the mount effect depends on refreshUser directly (stable identity, so the run-once-on-mount behavior is unchanged). - configProvider: kept 'user' as a dependency with a comment explaining why (config can differ per user, even though getConfig() doesn't read user itself). - metadata.tsx: pulled m[1] into a variable so the dependency array isn't a complex expression. - fileRenderers/simple.tsx: added the missing 'presign' dependency. - fileRenderers/useMarkdownProcessor.tsx: added the missing repoId, refId, path and presign dependencies, all of which the effect actually uses to build the markdown pipeline. - fileRenderers/data.tsx: kept the disable, with a comment, since the query is meant to run on Run/submit or file-identity changes, not on every keystroke while editing the SQL.
|
Hi Anurag, Thanks for taking this on and reviewing all the existing exhaustive-deps TODOs. I reviewed the changes in PR #10607. The dependency fixes and the explanations for the intentionally retained exceptions look reasonable overall. One area worth validating before merge is the SQL editor behavior in Since This would help distinguish the intended run-on-submit behavior from a potential stale-state issue. Thanks for the cleanup. Best regards, |
…DB renderer DuckDBRenderer reads sql from the effect closure and only re-runs on shouldSubmit, so add targeted tests that edit the query and then press Execute / Ctrl+Enter, asserting the edited text - not the mount-time query - reaches runDuckDBQuery. Editing alone must not re-run it.
|
@yigitcan-ozturk — thanks for the review, and for spotting that I added the targeted test you asked for in commit 4fd581d:
To check the test actually distinguishes the intended run-on-submit behaviour from the stale-closure risk you described, I temporarily made the effect read the SQL captured at mount (
Local run: |
Closes #9964.
Went through every
// TODO: Review and remove this eslint-disable once dependencies are validatedleft by the exhaustive-deps rollout and resolved each one:authContext.tsx:refreshUsernow uses a functionalsetStatusupdate instead of readingstatusfrom its closure, so its deps array can stay[]without lying about it. The mount effect now depends onrefreshUserdirectly, which is safe since its identity is now actually stable.configProvider.tsx: keptuseras a dependency, replaced the TODO with a comment explaining why — config can differ per user even thoughgetConfig()doesn't readuseritself.metadata.tsx: pulledm[1]into a local variable so the dependency array isn't a complex expression eslint can't check.fileRenderers/simple.tsx: added the missingpresigndependency.fileRenderers/useMarkdownProcessor.tsx: added the missingrepoId,refId,path,presigndependencies — the effect actually uses all of them to build the markdown pipeline.fileRenderers/data.tsx: kept the disable (with a comment this time) — the SQL query is only meant to re-run on Run/submit or when the file changes, not on every keystroke in the editor.Verified with
npx eslint src(clean, no remaining exhaustive-deps violations in these files) andnpx vitest run(all 72 existing tests pass). Also ranvite buildto make sure nothing broke at build time.