Skip to content

style(ui): format ui/src with prettier and check it in CI - #522

Merged
zaebee merged 1 commit into
mainfrom
claude/adoring-knuth-m6hrdb
Oct 1, 2026
Merged

zaebee merged 1 commit into
mainfrom
claude/adoring-knuth-m6hrdb

Conversation

@zaebee

@zaebee zaebee commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Follow-up to #517, which left this out of scope.

Problem

bun run format:check (prettier --check src/) failed on 31 files in ui/. Formatting had drifted with nothing to catch it. eslint-config-prettier switches ESLint's style rules off, so neither ESLint nor any CI step reports it.

What changes

  • All 31 files reformatted with bun run format. This uses the repository's own ui/.prettierrc; the config is unchanged. The diff is whitespace and wrapping only (+975 / −820), and there are no hand edits.
  • New CI step in the UI job: Prettier → bun run format:check, after ESLint. Without it formatting would drift again.

Review tip

Hide whitespace changes in the diff view (?w=1). Nothing should remain except lines that prettier rewrapped.

Test plan

  • bun run format:check passes (was: 31 files).
  • bun run lint, bun run typecheck, bun run test:run (14 files, 119 tests) and bun run build all exit 0 after the reformat.
  • actionlint clean on ui.yml.
  • The UI Verification job, including the new Prettier step, runs on this PR (it touches ui/**).

🤖 Generated with Claude Code

https://claude.ai/code/session_01Uv6LUrB5HCQcqBvmcixYn3


Generated by Claude Code

`prettier --check src/` failed on 31 files: formatting had drifted with no
check to catch it, and eslint-config-prettier switches ESLint's style rules
off, so nothing else would. All files are reformatted with the repository's
own .prettierrc (no config change), and the UI job gains a Prettier step
(`bun run format:check`) after ESLint.

Whitespace and wrapping only: lint, typecheck, the 119 vitest tests and the
build all pass after the reformat. Follow-up to #517.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uv6LUrB5HCQcqBvmcixYn3

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request primarily applies code formatting and style updates across the UI codebase, standardizing on double quotes and consistent line wrapping. The review feedback identifies a timing issue in both useLayoutComputation.ts and useFlowNavigation.ts where fitView is called synchronously immediately after updating the graph state. To ensure the viewport is calculated correctly after React Flow has completed rendering and measuring the new layout, it is recommended to wrap these fitView calls in requestAnimationFrame.

Comment thread ui/src/hooks/useLayoutComputation.ts
Comment thread ui/src/hooks/useFlowNavigation.ts
@sonarqubecloud

sonarqubecloud Bot commented Oct 1, 2026

Copy link
Copy Markdown

@zaebee
zaebee merged commit 8b9297f into main Oct 1, 2026
4 checks passed
@zaebee
zaebee deleted the claude/adoring-knuth-m6hrdb branch October 1, 2026 13:41
zaebee added a commit that referenced this pull request Oct 1, 2026
Both fitView calls ran synchronously after the store update that replaces
the nodes (setLayout / setFlow). React Flow had not rendered or measured the
new nodes yet, so the fit was computed against the previous view. Both are now
deferred to the next animation frame.

Measured in Chromium (Playwright) on the bundled graph.json, 3 runs each:
- clicking a node into flow view: main fits 2 of 95 nodes, zoomed to the 2x
  cap on the clicked node; with the fix all 95 are in view.
- initial load: all 94 nodes in view either way, but the fix fits them
  tighter (scale 0.197 -> 0.257), the old fit having included stale bounds.
No console errors in either.

useFlowNavigation.test.ts pinned the synchronous call; it now asserts that
fitView is not called in the same tick and is called, with the same options,
once the frame runs. It fails against the old hook.

Found by gemini-code-assist on #522, where it was out of scope for a
formatting-only change.


Claude-Session: https://claude.ai/code/session_01Uv6LUrB5HCQcqBvmcixYn3

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants