fix(devtools): keep the floating trigger in place on window resize - #529
Merged
Merged
Conversation
Store the floating trigger spot as a percent of the free space, not as pixels. On every resize the trigger is placed again from that percent, so it stays in its corner and cannot move off-screen. Drag and throw still work in pixels.
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository: TanStack/devtools/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merged
AlemTuzlak
added a commit
to bart-krakowski/devtools
that referenced
this pull request
Sep 23, 2026
Resolve conflicts with the percent-based trigger position from TanStack#529. The floating trigger keeps hot corners, edge docking, and magnetic mode, and now stores its spot as a percent of the free space.
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.
The floating trigger moved when the window size changed. It saved its spot as pixels from the top-left corner, so a trigger in the bottom-right corner drifted away from that corner when the window got bigger. This PR saves the spot as a percent of the free space and places the trigger again from that percent on every resize.
🎯 Changes
triggerCoordsnow holds a percent (0-100) of the free space from the left and top edges.{ x: 100, y: 100 }is the bottom-right corner.offsetWidth/offsetHeight, so the hover scale no longer changes the bounds.✅ Checklist
pnpm test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Testing
Commands run
vitest runinpackages/devtools: 19 files, 332 tests pass.tsc --noEmitandeslinton the changed files: no errors.pnpm test:pr.Manual test
pnpm --filter @tanstack/devtools-example-react-basic devand openhttp://localhost:3005.tanstack_devtools_settingskey in localStorage, then reload.main, it stays at the old pixel spot and moves away from the corner.How this PR makes testing easy
New unit tests in
trigger.test.tsxcover the percent helpers (toPercent,toPixels): the same percent maps to the same relative spot at any size, and the trigger stays inside the edges.Risk / rollback
A spot saved by an older version is in pixels. It is now read as a percent and clamped to 100, so the trigger can jump once, usually to the bottom-right corner. It always stays on the page. To undo, revert this PR.
Public API change
triggerCoordsin the devtools config has a new meaning.Before
After
🤖 Generated with Claude Code