Repository navigation
fix: popup not realigned after target position change on resize - #115
dogledogle wants to merge 1 commit into
Conversation
|
@dogledogle is attempting to deploy a commit to the afc163's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
定位更新与回归验证 src/Tour.tsx, tests/index.test.tsx |
对齐 effect 将 posInfo 加入依赖,并在变化时调用 forceAlign。新增测试验证目标位置和窗口尺寸变化后的占位元素及弹窗定位。Escape 关闭处理逻辑未变;测试中的回调格式和空行有所调整。 |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix
Merge Risk: 
Minimal · up to 62370
-
No merge-blocking issue was established for the popup alignment change.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.
-
Finishing Touches: 💡 1
-
🛠️ Fix failing CI checks: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 @coderabbitai help to get the list of available commands.
Problem
After a window resize, the Tour popup was not realigned to the target position. The mask and placeholder moved immediately, but the popup stayed at the stale position until an unrelated re-render happened.
窗口缩放后,Tour 弹层没有重新对齐到目标位置:遮罩和占位元素即时更新了,但弹层停留在旧位置,直到下一次无关渲染才恢复。
Before / After
Before
After
Root Cause
The measured target position (
posInfofromuseTarget) is committed and applied to the placeholder, but nothing forces the popup to re-align afterwards —forceAlign()was only triggered byarrowPointAtCenterormergedCurrentchanges. On resize/scroll, the popup aligned against the stale placeholder position and lagged one update behind.Fix
Add
posInfoto theuseLayoutEffectdependency list soforceAlign()runs right after the new position is committed to the DOM.posInfokeeps a stable reference when the target rect is unchanged, so no redundant alignment loop is introduced.A regression test is included: it resizes the window and asserts the popup aligns to the committed target position.
Changelog
Summary by CodeRabbit