Skip to content

fix(components): [affix] keep-alive cache confirm is working normally#23549

Merged
btea merged 2 commits into
element-plus:devfrom
E66Crisp:fix-affix
Jan 29, 2026
Merged

fix(components): [affix] keep-alive cache confirm is working normally#23549
btea merged 2 commits into
element-plus:devfrom
E66Crisp:fix-affix

Conversation

@E66Crisp
Copy link
Copy Markdown
Contributor

@E66Crisp E66Crisp commented Jan 29, 2026

Please make sure these boxes are checked before submitting your PR, thank you!

fix: #23548

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

Summary by CodeRabbit

  • Bug Fixes
    • Affix component now reliably recalculates its position when a view/page becomes active and resets its fixed state when it becomes inactive, preventing stuck positioning during navigation.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jan 29, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

Added Vue lifecycle hooks to the Affix component: onActivated triggers updateRootRect on next tick; onDeactivated clears the fixed state. No API signatures changed.

Changes

Cohort / File(s) Summary
Affix Lifecycle Management
packages/components/affix/src/affix.vue
Imported onActivated and onDeactivated; added onActivated handler to call updateRootRect after next tick and onDeactivated handler to set fixed = false. No other logic or public API changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • rzzf
  • keeplearning66
  • btea

Poem

🐰 I hop in code where hooks now play,
Activated, deactivated, night and day.
I nudge the rect and lift the pin,
So Affix rests where it should begin. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the fix for affix positioning issues under Vue KeepAlive cache, directly addressing the main change.
Description check ✅ Passed The PR description includes the issue reference (#23548) and confirms all required checklist items (contributing guide, dev branch, related issues).
Linked Issues check ✅ Passed The code changes implement lifecycle hooks (onActivated/onDeactivated) that restore correct affix positioning when components are activated or deactivated under KeepAlive, directly addressing issue #23548.
Out of Scope Changes check ✅ Passed All changes are focused on fixing the affix positioning issue under KeepAlive; no unrelated modifications detected in the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jan 29, 2026

Open in StackBlitz

pnpm add https://pkg.pr.new/element-plus/element-plus@23549
npm i https://pkg.pr.new/element-plus/element-plus@23549
yarn add https://pkg.pr.new/element-plus/[email protected]

commit: 190f9d9

Comment thread packages/components/affix/src/affix.vue Outdated
@E66Crisp E66Crisp requested a review from rzzf January 29, 2026 03:18
@github-actions
Copy link
Copy Markdown
Contributor

🧪 Playground Preview: https://element-plus.run/?pr=23549
Please comment the example via this playground if needed.

@btea btea merged commit d2e2ff3 into element-plus:dev Jan 29, 2026
17 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

@E66Crisp Thanks for your contribution! ❤️

@btea btea changed the title fix(components): [affix] positioning under KeepAlive cache fix(components): [affix] keep-alive cache confirm is working normally. Jan 29, 2026
@github-actions github-actions Bot added the CommitMessage::Unqualified Unqualified commit message label Jan 29, 2026
@E66Crisp E66Crisp changed the title fix(components): [affix] keep-alive cache confirm is working normally. fix(components): [affix] keep-alive cache confirm is working normally Jan 29, 2026
@github-actions github-actions Bot removed the CommitMessage::Unqualified Unqualified commit message label Jan 29, 2026
@element-bot element-bot mentioned this pull request Jan 30, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Component] [affix] affix显示异常

3 participants