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(cdk:scroll): content is blank when re-activated in keepalive mode #1505

Merged
merged 1 commit into from
Mar 20, 2023

Conversation

sallerli1
Copy link
Collaborator

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines
  • Tests for the changes have been added/updated or not needed
  • Docs and demo have been added/updated or not needed

What is the current behavior?

keepAlive 模式下,再切回到有虚拟滚动的页面,由于页面滚动的位置被重置而储存的滚动位置没有变,导致虚拟滚动内容是空的

What is the new behavior?

activated钩子中,重置holder的scrollTop

Other information

@idux-bot
Copy link

idux-bot bot commented Mar 20, 2023

This preview will be available after the AzureCI is passed.

}
}
onActivated(initScrollTop)

return { syncScrollTop, handleScroll }
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with a brief review

This code patch looks to be making a change to the useScrollPlacement() function. The first change is to import the onActivated hook from Vue. The second is to add the initScrollTop() function, which will sync the initial scrollTop value when the holderRef has been set. This should help prevent any initial UI issues.

Overall, the code looks to be well written and should have minimal risk of bugs. The only suggestion I have is to consider adding some unit tests for the new initScrollTop() function to ensure it works correctly.

@codecov
Copy link

codecov bot commented Mar 20, 2023

Codecov Report

Merging #1505 (93d0eaa) into main (88a6d3f) will not change coverage.
The diff coverage is n/a.

❗ Current head 93d0eaa differs from pull request most recent head 2736511. Consider uploading reports for the commit 2736511 to get more accurate results

@@           Coverage Diff           @@
##             main    #1505   +/-   ##
=======================================
  Coverage   92.75%   92.75%           
=======================================
  Files         331      331           
  Lines       30801    30801           
  Branches     3532     3533    +1     
=======================================
  Hits        28568    28568           
  Misses       2233     2233           

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

@danranVm danranVm merged commit 2d74862 into IDuxFE:main Mar 20, 2023
@sallerli1 sallerli1 deleted the fix-virtual-scroll-keepalive branch July 4, 2024 09:27
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.

2 participants