-
Notifications
You must be signed in to change notification settings - Fork 734
Use react-freeze to optimize TabController pages #1639
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
Conversation
runOnJS(setFocused)(true); | ||
} | ||
|
||
if (wasActive && wasActive !== isActive) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not wasActive && !isActive
or (to be sure we don't have a race condition):
if (isActive) {
...
} else if (wasActive) {
runOnJS(setFocused)(false);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I change it.. now it's better.
Apparently we got to this part of code more than once, after adding currentPage
to dependency array of useAnimatedReaction
it fixed it.. so we can rely completely on wasActive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@M-i-k-e-l
I changed the implementation again, I think it's even simpler now
It has a single useAnimatedReaction
so I think it's more bug prune
Let me know if you find something 😬
@M-i-k-e-l |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we saw, adding the following log reveals problems in the logic of the frozen tabs:
console.log('Ethan', index, !shouldLoad || !focused);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When on the Posts tab (index=1), do we want the Reviews (index=2) to load? It does not.
The right thing to check is |
But if we freeze when |
Description
Use react-freeze to optimize functionality of TabController.TabPage so pages that are not focused will not trigger renders
Changelog
Use react-freeze to optimize functionality of TabController.TabPage so pages that are not focused will not trigger renders