Skip to content

fix(web-ui): stabilize initial code editor range navigation#1279

Merged
wsp1911 merged 1 commit into
GCWing:mainfrom
wsp1911:main
Jun 22, 2026
Merged

fix(web-ui): stabilize initial code editor range navigation#1279
wsp1911 merged 1 commit into
GCWing:mainfrom
wsp1911:main

Conversation

@wsp1911

@wsp1911 wsp1911 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stabilize file-link line range navigation in the Web UI code editor.

When a flow chat file link opens a file in a new editor tab, the target line range could already be selected while the viewport still stayed near the top of the file on the first click. This change moves the fix into CodeEditor so navigation is only considered complete after the editor viewport is ready and the target range is actually visible.

Fixes #

Type and Areas

Type:

regression fix / bug fix / UI/UX

Areas:

web UI

Motivation / Impact

This fixes a timing issue in initial editor navigation for file links with line ranges.

Before this change, the first click could open the file and apply the selection but fail to keep the requested range in view until the user clicked the same link again. After this change, CodeEditor keeps a pending navigation request, waits for the editor to become active and layout-stable, and only completes once the requested range is visible. The fix is scoped to the editor navigation path and avoids adding ad hoc delays in upstream callers.

Verification

  • pnpm run type-check:web
  • Manual check: clicked a flow chat file link with a line range such as sessionStoragePortable.ts:311-318 when opening a new editor tab from the right panel collapsed state
  • Manual check: verified the first click now opens the file and scrolls to the requested range without requiring a second click

Reviewer Notes

The fix is intentionally localized to src/web-ui/src/tools/editor/components/CodeEditor.tsx.

Instead of relying on a fixed timeout from flow chat or tab-opening code, the editor now:

  • tracks pending navigation requests
  • waits for active-tab and viewport readiness
  • rechecks layout/resize/content signals for a short bounded recovery window
  • clears navigation state on file changes and unmount

This keeps the behavior durable for other future range-based editor entry points as well.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@wsp1911
wsp1911 force-pushed the main branch 2 times, most recently from bf7eeac to ad5b9c0 Compare June 22, 2026 10:35
- track pending range navigation requests in CodeEditor
- retry initial reveal on layout and resize signals until the target range is visible
- clear pending navigation state on file switches and editor unmount
- keep range jumping scoped to active tabs to avoid background side effects
@wsp1911
wsp1911 marked this pull request as ready for review June 22, 2026 10:45
@wsp1911
wsp1911 merged commit 52775b4 into GCWing:main Jun 22, 2026
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.

1 participant