Repository navigation
fix(devtools): reposition the docked edge trigger tab on window resize - #45
Open
detail-app[bot] wants to merge 1 commit into
Open
detail-app[bot] wants to merge 1 commit into
detail-app[bot] wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Detail bug report: View on Detail
🎯 Changes
Bug: While the floating trigger is docked against a viewport edge (the slim "edge tab"), a
windowresizenever recomputed the tab's along-edge pixel position. The resize listener early-returned when docked (a guard added alongside the dock feature in TanStack#521), andedgeTabStylecomputed itstop/leftfrom a non-reactive viewport read plus a frozen pixel — either the stale drag-release pixel fromcoords()(freshly docked) or the stored percent mapped once at mount (reload-docked). Shrinking the window left the tab fixed-positioned outside the new viewport, so a mouse user who docked near the bottom/side and then shrank the window lost all mouse access to the devtools until reload orCtrl+~.Fix (
packages/devtools/src/components/trigger.tsx):viewportTicksignal bumped onresizewhile docked, since the viewport is read through plain DOM (documentElement.clientWidth/Height) and is otherwise non-reactive.edgeTabStylenow readsviewportTick()on the docked branch so it re-runs on resize, and prefers the viewport-size-agnostic stored percent over the stalecoords()pixel while docked — matching the reload-docked path the bug report identifies as the self-healing case. The mid-drag preview branch still usescoords()so the preview keeps tracking the cursor.resizeeffect no longer early-returns when docked; it bumpsviewportTickinstead. The undocked path (placeFromSettingsfrom the stored percent) is unchanged.This mirrors the approach the undocked floating trigger already uses (store the spot as a percent, remap on every resize from TanStack#529), extended to the docked tab.
✅ Checklist
pnpm test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Testing
packages/devtools/src/components/trigger.test.tsx): added 9 tests covering both dock flavors (freshly docked via drag-release and reload-docked from persisted settings) and both edge axes (verticalrightand horizontalbottom), plus the across-resize percent round-trip, no-op resize idempotency, the dock→resize→undock recovery path, and no-regression coverage for the undocked floating trigger resize and the mid-drag edge preview. The full file passes 49/49; the full@tanstack/devtoolslibrary suite passes 379/379. Bug-inversion confirmed: the 4 docked-resize tests fail without the source fix (the 5 no-regression tests pass without it).e2e/apps/solid/tests/trigger-dock-resize.spec.ts, new Playwright test in the existing solid e2e app): drives a real Chromium browser — drags the floating trigger to dock against the right edge, shrinks the viewport to 400px tall, asserts the docked tab's bounding box is fully inside the new viewport and still anchored to the right edge, then clicks the tab and asserts the devtools panel opens. Passes with the fix; bug-inversion confirmed end-to-end (without the fix the tab sits at y≈712 in the 400px viewport, fully off-screen). The existingsolid.spec.tstrigger-click → panel-open test still passes — 2/2 in the solid e2e suite.tsc(strict),eslint ./src, prettier--check,tsupbuild,publint --strict, andsize-limit(dist/index.js= 65.61 KB ≤ 66 KB) all pass.Automatic Fixes PRs can be configured here.