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

WhenVisible useEffect function is not recreated when params change. #2152 #2153

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Loeffeldude
Copy link

Closes #2152. Adds the needed dependencies to the useEffect and adds a few refs to keep the same fetching behavior as before.

Copy link

@PedroAugustoRamalhoDuarte PedroAugustoRamalhoDuarte left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @Loeffeldude !!

(entries) => {
if (!entries[0].isIntersecting) {
return
}

if (!always) {
observer.current?.disconnect()
if (!always && fetchedOnce) {

Choose a reason for hiding this comment

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

maybe here we need to call .current?

Suggested change
if (!always && fetchedOnce) {
if (!always && fetchedOnce.current) {

Copy link
Author

Choose a reason for hiding this comment

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

Oops yeah my bad. Fixed it.

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.

WhenVisible useEffect function is not recreated when params change.
2 participants