Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Anchor): fix highlighting failure when dynamically updating items #40743

Merged
merged 3 commits into from
Mar 10, 2023

Conversation

zqran
Copy link
Contributor

@zqran zqran commented Feb 15, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

💡 Background and solution

复现地址

复现步骤:

  1. 进入页面后,点击右上角按钮,新增一个 anchor 节点
  2. 滚动页面到底部,出现第一个 Bug:最后一个节点未高亮
  3. 滚动回到页面顶部,再次点击右上角按钮,滚动页面,此时出现第二个 Bug:anchor 节点不再高亮

📝 Changelog

Language Changelog
🇺🇸 English fix highlighting failure when dynamically updating items
🇨🇳 Chinese 修复动态添加 items 后高亮失效问题

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@github-actions
Copy link
Contributor

github-actions bot commented Feb 15, 2023

@codecov
Copy link

codecov bot commented Feb 15, 2023

Codecov Report

Base: 100.00% // Head: 100.00% // No change to project coverage 👍

Coverage data is based on head (c196b5c) compared to base (910d0fc).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #40743   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          606       606           
  Lines        10289     10287    -2     
  Branches      2790      2790           
=========================================
- Hits         10289     10287    -2     
Impacted Files Coverage Δ
components/anchor/AnchorLink.tsx 100.00% <ø> (ø)
components/anchor/Anchor.tsx 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@MadCcc
Copy link
Member

MadCcc commented Feb 16, 2023

来个测试用例?

@MadCcc
Copy link
Member

MadCcc commented Feb 16, 2023

一个经典 useEvent 场景

@li-jia-nan
Copy link
Member

看样子是我之前重构 FC 改出问题了……

@zqran
Copy link
Contributor Author

zqran commented Feb 16, 2023

看样子是我之前重构 FC 改出问题了……

React 的依赖项,还是挺坑的~

@afc163
Copy link
Member

afc163 commented Feb 16, 2023

来个测试用例?

@zqran
Copy link
Contributor Author

zqran commented Feb 17, 2023

来个测试用例?

@MadCcc 求助攻~

@frankA10019
Copy link

any update?

@li-jia-nan
Copy link
Member

本地试了一下没有问题,先 merge 了,测试用例我单独开个 PR 补一下吧

@li-jia-nan li-jia-nan merged commit 9893936 into ant-design:master Mar 10, 2023
@li-jia-nan
Copy link
Member

本地试了一下没有问题,先 merge 了,测试用例我单独开个 PR 补一下吧

@pc110
Copy link

pc110 commented Mar 10, 2023

看样子是我之前重构 FC 改出问题了……

Bug 最近很多哦,有很多很表面的bug哟, 注意下代码质量哟

@zombieJ zombieJ mentioned this pull request Mar 13, 2023
16 tasks
RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 4, 2023
…ant-design#40743)

* fix(Anchor): fix highlighting failure when dynamically updating items

* fix: improve test coverage

* refactor(Anchor): use `useEvent` instead
RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 25, 2023
…ant-design#40743)

* fix(Anchor): fix highlighting failure when dynamically updating items

* fix: improve test coverage

* refactor(Anchor): use `useEvent` instead
RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 25, 2023
…ant-design#40743)

* fix(Anchor): fix highlighting failure when dynamically updating items

* fix: improve test coverage

* refactor(Anchor): use `useEvent` instead
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.

anchor 使用動態 items 會產生問題
6 participants