-
-
Notifications
You must be signed in to change notification settings - Fork 654
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
Logout gives endless loading screen #4723
Labels
Comments
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this issue
May 7, 2021
…ent`. Before, whenever `AppNavigator` was called, a new value was passed to these `Stack.Screen`s as `component`. That's because `withHaveServerDataGate` returns a fresh component made by react-redux's `connect`. We found with a bisect that something in a80b4e8 was causing Here, we stop letting that value change, and we see that it fixes zulip#4603. Alternatively, we might have put the `withHaveServerDataGate` call in the same file as `MainTabsScreen`, etc. -- after all, that's our usual practice for higher-order components. But the choice to put it in AppNavigator (in a80b4e8 and f53d4f6) was intentional: we wanted to make it easy to scan through and spot any that should be treated with `withHaveServerDataGate` and aren't. This approach lets us keep the calls in AppNavigator, but it adds some ugly boilerplate. Ah, well. We considered `useMemo` instead of `useRef`, but the documentation [1] cautions against that for cases like these: > **You may rely on useMemo as a performance optimization, not as a > semantic guarantee.** In the future, React may choose to “forget” > some previously memoized values and recalculate them on next > render, e.g. to free memory for offscreen components. Write your > code so that it still works without `useMemo` — and then add it to > optimize performance. So, use `useRef`. [1] https://reactjs.org/docs/hooks-reference.html#useref Fixes: zulip#4723
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this issue
May 7, 2021
…ent`. Before, whenever `AppNavigator` was called, a new value was passed to these `Stack.Screen`s as `component`. That's because `withHaveServerDataGate` returns a fresh component made by react-redux's `connect`. We found with a bisect that something in a80b4e8 was causing Here, we stop letting that value change, and we see that it fixes zulip#4603. Alternatively, we might have put the `withHaveServerDataGate` call in the same file as `MainTabsScreen`, etc. -- after all, that's our usual practice for higher-order components. But the choice to put it in AppNavigator (in a80b4e8 and f53d4f6) was intentional: we wanted to make it easy to scan through and spot any that should be treated with `withHaveServerDataGate` and aren't. This approach lets us keep the calls in AppNavigator, but it adds some ugly boilerplate. Ah, well. We considered `useMemo` instead of `useRef`, but the documentation [1] cautions against that for cases like these: > **You may rely on useMemo as a performance optimization, not as a > semantic guarantee.** In the future, React may choose to “forget” > some previously memoized values and recalculate them on next > render, e.g. to free memory for offscreen components. Write your > code so that it still works without `useMemo` — and then add it to > optimize performance. So, use `useRef`. [1] https://reactjs.org/docs/hooks-reference.html#usememo Fixes: zulip#4723
chrisbobbe
added a commit
to chrisbobbe/zulip-mobile
that referenced
this issue
May 7, 2021
…ent`. Before, whenever `AppNavigator` was called, a new value was passed to these `Stack.Screen`s as `component`. That's because `withHaveServerDataGate` returns a fresh component made by react-redux's `connect`. We found with a bisect that something in a80b4e8 was causing zulip#4723. Here, we stop letting that value change, and we see that it fixes that issue. Alternatively, we might have put the `withHaveServerDataGate` call in the same file as `MainTabsScreen`, etc. -- after all, that's our usual practice for higher-order components. But the choice to put it in AppNavigator (in a80b4e8 and f53d4f6) was intentional: we wanted to make it easy to scan through and spot any that should be treated with `withHaveServerDataGate` and aren't. This approach lets us keep the calls in AppNavigator, but it adds some ugly boilerplate. Ah, well. We considered `useMemo` instead of `useRef`, but the documentation [1] cautions against that for cases like these: > **You may rely on useMemo as a performance optimization, not as a > semantic guarantee.** In the future, React may choose to “forget” > some previously memoized values and recalculate them on next > render, e.g. to free memory for offscreen components. Write your > code so that it still works without `useMemo` — and then add it to > optimize performance. So, use `useRef`. [1] https://reactjs.org/docs/hooks-reference.html#usememo Fixes: zulip#4723
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This seems to reproduce reliably for me, on v27.162, on both iOS and Android. Not sure if it's new in v27.162 or was present earlier.
Repro steps:
Expected result:
Actual result:
We probably want to change what the "Log out" button does entirely. But that isn't a trivial change to make, and I suspect that taking care of it will involve basically debugging this issue anyway -- the key thing that should be happening here and doesn't seem to be is the navigation, and we'll still want to make the same navigation after that change.
The text was updated successfully, but these errors were encountered: