Skip to content

webui: clean up exhaustive-deps TODOs in auth, config and file renderers - #10607

Open
shaktimaan00 wants to merge 2 commits into
treeverse:masterfrom
shaktimaan00:fix/webui-exhaustive-deps-cleanup
Open

shaktimaan00 wants to merge 2 commits into
treeverse:masterfrom
shaktimaan00:fix/webui-exhaustive-deps-cleanup

Conversation

@shaktimaan00

Copy link
Copy Markdown

Closes #9964.

Went through every // TODO: Review and remove this eslint-disable once dependencies are validated left by the exhaustive-deps rollout and resolved each one:

  • authContext.tsx: refreshUser now uses a functional setStatus update instead of reading status from its closure, so its deps array can stay [] without lying about it. The mount effect now depends on refreshUser directly, which is safe since its identity is now actually stable.
  • configProvider.tsx: kept user as a dependency, replaced the TODO 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 local variable so the dependency array isn't a complex expression eslint can't check.
  • fileRenderers/simple.tsx: added the missing presign dependency.
  • fileRenderers/useMarkdownProcessor.tsx: added the missing repoId, refId, path, presign dependencies — 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) and npx vitest run (all 72 existing tests pass). Also ran vite build to make sure nothing broke at build time.

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.
@CLAassistant

CLAassistant commented Nov 11, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added the area/UI Improvements or additions to UI label Nov 11, 2026
@yigitcan-ozturk

Copy link
Copy Markdown

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 fileRenderers/data.tsx.

Since sql is intentionally excluded from the effect dependencies, could we confirm with a targeted test that editing a query and then pressing Run always executes the latest SQL text, rather than a stale closure value?

This would help distinguish the intended run-on-submit behavior from a potential stale-state issue.

Thanks for the cleanup.

Best regards,
Yiğitcan Öztürk
PAMILANGA Ltd.

…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.
@github-actions github-actions Bot added the area/testing Improvements or additions to tests label Nov 11, 2026
@shaktimaan00

Copy link
Copy Markdown
Author

@yigitcan-ozturk — thanks for the review, and for spotting that sql needed explicit coverage rather than just a comment.

I added the targeted test you asked for in commit 4fd581d: webui/src/pages/repositories/repository/fileRenderers/data.test.tsx. It renders DuckDBRenderer with runDuckDBQuery mocked and asserts:

  • mount runs the initial READ_PARQUET(...) query;
  • edit then press Execute — the last runDuckDBQuery call receives the edited text (SELECT 42), not the mount-time query — and editing alone does not re-run the query (that is the whole point of keeping sql out of the deps, otherwise every keystroke would hit DuckDB);
  • edit then Ctrl+Enter (onRun in the editor) behaves the same way.

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 (useRef(sql).current): both "edited" cases fail with the mount-time query (Expected "SELECT 42" / Received "SELECT * FROM READ_PARQUET(...) LIMIT 20"), and pass again with the current code. So a stale closure would be caught.

sql remains intentionally excluded from the effect deps, and the existing comment above the effect is unchanged.

Local run: npm test → 7 files / 75 tests pass, npm run lint clean, prettier --check clean. Happy to adjust if you'd rather the assertion live somewhere else (e.g. a hook-level test instead of the component).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing Improvements or additions to tests area/UI Improvements or additions to UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

webui: exhaustive-deps cleanup

3 participants