-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
[iOS] Global create is open on account creation/sign-in, but isn't visible #5303
Comments
Triggered auto assignment to @jboniface ( |
Triggered auto assignment to @ctkochan22 ( |
Reproduced while testing fix for https://github.com/Expensify/Expensify/issues/177787#issuecomment-921377044 Reproduction step:
|
I bet it has something to do with why we need a timeout on this line: App/src/pages/home/sidebar/SidebarScreen.js Lines 84 to 86 in 09e2d94
By setting timeout to 0, and NVP "isFirstTimeNewExpensifyUser" to true, i can reproduce this consistently. I think this means, we are opening it before its either gotten the info it needs, or before something can be built/rendered? |
@Beamanator do you have an idea? I see you are familiar with this area |
I'm the one who merged in this I created another issue to get contributor ideas why I'll try Marc's idea here: #5214 (comment) |
Here's what happened when I tried @marcaaron 's idea, and the changes I made: Workflow:
Code changed & logs added:
function get(name, onyxKey, defaultValue) {
API.Get({
returnValueList: 'nameValuePairs',
name,
})
.then((response) => {
const value = lodashGet(response.nameValuePairs, [name], defaultValue || '');
// Log the time this is called so we know when Onyx.set "should have been" called
if (name === 'isFirstTimeNewExpensifyUser') console.log('[AuthScreens] setting nvp to ', value);
Onyx.set(onyxKey, value);
});
}
Order of logs when following the workflow:
Question: In cc @kidroca since you're pretty experienced with react-native-onyx |
@Beamanator if (this.props.isFirstTimeNewExpensifyUser) {
/* Bunch of code */
// Set the NVP to false so we don't automatically open the menu again
// Note: this may need to be moved if this NVP is used for anything else later
NameValuePair.set(CONST.NVP.IS_FIRST_TIME_NEW_EXPENSIFY_USER, false, ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER);
} So it's initially I've deliberately altered this to force a src/libs/actions/NameValuePair.jsfunction get(name, onyxKey, defaultValue) {
API.Get({
returnValueList: 'nameValuePairs',
name,
})
.then((response) => {
let value = lodashGet(response.nameValuePairs, [name], defaultValue || '');
if (onyxKey === 'isFirstTimeNewExpensifyUser') {
console.log('isFirstTimeNewExpensifyUser: ', value);
value = true;
}
Onyx.set(onyxKey, value);
});
}
It's seems it might have to do with the other expression |
@kidroca yeah sorry my notes may not have been super clear, I ended up stripping most of the stuff in Here's a branch with what I was testing: https://github.com/Expensify/App/tree/beaman-investigatingGlobalCreateFishyness
Note: As mentioned above, I also added a log in In
|
What I've found out is that without the |
@Beamanator The reason you don't get the value in
cc @marcaaron @tgolen I think this is a caveat about |
Here's a non Make /* we want to open the menu for first time experience, and then we flag the experience as complete */
NameValuePair
.get(CONST.NVP.IS_FIRST_TIME_NEW_EXPENSIFY_USER, ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER, true)
.then(value => this.setState({isCreateMenuActive: value}))
.then(() => NameValuePair.set(CONST.NVP.IS_FIRST_TIME_NEW_EXPENSIFY_USER, false, ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER)); Here's a full diff: Screen.Recording.2021-09-17.at.18.07.20.mov |
Ooo interesting. Let me test this out locally (sorry just catching up) |
Still trying to grasp the issue. If i'm following your logic correctly, @kidroca , you're saying it doesn't run componentDidMount() until the ONYX keys are loaded. So it defaults to |
I think Peter is saying this isn't a React lifecycle problem, but maybe a bug with |
Correct.
That prop is not getting any updates after the component mounts To make that work correctly we'll want to remove
Judging by the problem description, the "existing" logic is working correctly, it's just that it "fires" too soon (even with a timeout) |
I don't think it's true. https://snack.expo.dev/@parasaharrajat/react-native-modal-example Check the Snack. It works great. |
Yes, I've seen others have the problem opening a modal as soon as another modal closes, which results in a similar experience - |
I made sure to test this scene, but I tried reducing the render to minimal but I found that it's not affected by rerendering. |
I saw the |
Tried simply wrapping the |
I ran a debugger over the I removed the nested props and directly set the isVisible true in BaseModal and the result was the same. I am not sure what could be the reason that React is not passing that prop correctly. I think the solution here by Kidroca is correct. We should wait for the drawer to be shown completely and then show the modal if that works. |
Was trying this, but ran into an issue where this prop just isn't present: react-navigation/react-navigation#9878 |
In the meantime, can we maybe fix this more consistently by just increasing the timeout to 1500 ms or something? AFAICT that wouldn't result in a very adverse effect in the UX – when you open the app for the first time, 1.5 seconds later the global create menu opens. This is prettymuch the effect we want, and the minor delay likely isn't going to have an effect on usability. This one-time action is not a performance-critical flow, so the hack might be acceptable for now. Thoughts? |
I think if we're in a hurry and it wont hurt UX, it'll be ok for the moment
We should at least change the logic for the check to be inside the componentDidMount() {
Performance.markStart(CONST.TIMING.SIDEBAR_LOADED);
Timing.start(CONST.TIMING.SIDEBAR_LOADED, true);
setTimeout(() => {
if (this.props.isFirstTimeNewExpensifyUser) {
/* rest of the code */
}
}, 1500);
} This way we're using the latest |
Agreed, this seems like the easiest fix right now
+1 as well
I agree adding some onboarding indications could make the UX better here, but I think the 1500ms will work for now. |
Noticing a lot of people are assigned to this issue, but I'm going to submit a pull request to increase the timeout. Please DM me if you're already working on this. |
No closed Botify |
Why no closed? |
I thought we closed when the PR hit production |
For external contributors we close the issue 7 days after the fix has been deployed to production. For internal contributors we generally close it right away (and reopen if the PR fails QA) |
I'm trying to understand this issue a bit to clear up the I can see it happen if we try to initialize the global create menu with Maybe it only affects certain versions of iOS... |
Tested on iOS 13-15 and can't get it to happen. I think the moving the logic in this PR fixed the problem, but unsure why. |
It was definitely still happening then, because I tried to remove it and failed. Although I thought I left a comment somewhere about it fixing a race condition and not a bug with react-navigation. |
I think it depends on render/networking time Looks like the bug is between our code, react native navigation and react native modal, but it's not clear which side the
I suppose it's a problem with the View Controller react native modal tries to use to manage modals and the navigation initializing Similar problem that has no development but using |
Interesting, I'm trying to find out what the "sometimes" factor is here. So far, it has been working fine for me and anyone else who has tested on iOS so I'm inclined to see if it will pop up again. |
As far as I remember it depended on the timing of the response to one "get keyval pair" |
Changes here are what I have been testing -> #8827 |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Action Performed:
Expected Result:
Global create should be open and visible on account creation
Actual Result:
Global create doesn't show up
Workaround:
Workaround is close and re-open, but this is a critical first-user experience, so this workaround isn't acceptable
Platform:
Where is this issue occurring?
Version Number: 1.0.99-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Expensify/Expensify Issue URL: N/A
Issue reported by: Marc
Slack conversation: https://expensify.slack.com/archives/C020EPP9B9A/p1631816718390200
View all open jobs on GitHub
The text was updated successfully, but these errors were encountered: