-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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: navigation to report screen from the SideModals #6207
Conversation
It fixes various issues - Preserving the proper history - Clearing the old Draft message from the composer
@mountiny Could you please test it on IOS? I think it works but just in case. |
@parasharrajat I think my environment is also messed up the last time I tried 😄 but I will try. However, in your screen recordings you have not shown that the original problem has been resolved. There was no draft in the reports before switching to see if the draft was not carried over. I cannot test right now, but I will get to it hopefully by tomorrow. Would you be able to provide video of the QA steps you describe in the PR body? |
Oops, I forgot to show that. I will add another video for android and web to show that. |
@mountiny Added more videos to Web and android |
Adding myself as a reviewer so that we can find a longer term solution here. It feels like we are making changes to this file on a weekly basis 😄 |
Haha yeah. This is just changed a while back but all changes are progressive. The next change will happen when the working back handler PR will be merged. But again that will be progressive. Lol. Thanks for reviewing it, I am always afraid of breaking something. |
@parasharrajat Fixed my environment and tested on iOS, seems like everything works as it should 🎉 Simulator.Screen.Recording.-.iPhone.12.-.2021-11-05.at.16.43.07.mp4 |
Thanks, @mountiny. I also fixed my network interface on Mac today. There are a couple of other issues that need it... |
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.
Code-wise, I can't think of any improvements, but I am sure eagle 👀 @marcaaron will find something 😅 also havent worked much with Navigation so I will leave this one for you @marcaaron to review and merge.
Marc is OOO this week, so I would expect his review coming next week. I will wait for it unless we get more reports of users being annoyed by this bug which would prove urgency of this fix. |
@parasharrajat Bumping merge conflicts here. Thank you for your patience. |
Oh, this conflict is again from my changes on other PR. Lol... resolving... |
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.
@parasharrajat can you explain why these changes fix the linked issue? I don't really get what is happening and feel like we are just digging ourselves into a hole with all the CustomActions
stuff...
This change will pass the navigation to drawer job to last code which reset the state and remount the report screen just like the Navigation from LHN. Now mounting clears the draft from previous report. |
Hmm sorry I don't really understand. Can you try to maybe rephrase that? What do you mean by "drawer job to last code"? |
Ah, sorry. So whenever we navigate to a screen on the drawer navigator, new changes will remount the ReportScreen. |
Which changes are we talking about exactly?
I'm stuck on this part. What "state" are we talking about here specifically and what is the "that" which we are only doing when navigating from the LHN? |
Oops.
I am talking about the new changes in this PR.
Navigation state. That is used for remount the ReportScreen |
Hmm something still doesn't fit here. We are altering the navigation code so that the report screen remounts. But why should this matter? Either we should be able to update the report and have the report screen re-render (i.e. run whatever initialization logic it needs) or have it re-mount by default. Maybe it would be useful to break down step by step exactly what happens? |
Sure. I have added a detailed explanation for why I chose this path instead of fixing the race conditions (mentioned on the link) in We will not need these changes if we can deliver the new comment for a report as soon as the report changes. I don't see a straight way to re-render the component when the draft prop is changed due to report change. Draft prop will change often, precisely on each keystroke. But how can we know that prop contains the draft for the new report? Please let me know if you see a way to do this, I would be happy to refactor the PR. |
Hmm yeah I think I just disagree with your assessment of this issue. It doesn't quite feel like a navigation problem to me and as I've expressed previously - we are digging ourselves into a deep hole with a lot of custom navigation logic that is not easy to understand. But I could be wrong about that... From your original proposal:
Why do the report and comment prop not update in a sync manner? It seems like we should be trying to solve that problem.
Again, I could be off here - but it sounds like we are avoiding the real solution because it is "hard". But if there's a race condition we should figure out what it is and whether there's something we can do about it? |
Sorry, I didn't respond to this because I'm not really sure what you are asking. |
This is why this issue is occurring. in App/src/pages/home/report/ReportActionCompose.js Lines 201 to 206 in 0dfdf36
But we do not get the draft of the new report when this happens. this.prop.comment still contains the old draft. We should find a solution to it but I didn't find any. It could be an Onyx issue. I just thought of LHN behaviour and tried to use the same every time we navigate to a report from any navigator.
Please ignore it. |
Ok it's starting to come into focus for me, thanks for your patience. Let me see if I've got it right... we are correct to perform a side effect and the Just have a couple more questions now...
|
I think it should if possible. It could resolve a few bugs in the future and help us remove code complexity for such scenarios. Basically, we have two subscriptions A and B. and both A and B depend on prop C.
Yeah, I think the same. I should clean the |
Should we do A or B? A:
B:
|
I think B is better if we can do that. But I also think there is added advantage of using A. It would help fix the History of navigation. There is an open issue that I think is related and caused by messed-up history. #4612. We added the custom navigation action for the drawer so that we can reset the state and manage the history stack when the report id changes and I think we need the same for the Chat switcher (Search page) as well. So if it does fix the history then we should do A to make it consistent for the whole app to navigate the report screen in the same way. |
Alright, I left a comment in that issue, but basically I really want to see if we can move away from the custom logic we have and try to influence some changes to |
I think a good general plan of action here would be to:
FWIW, that is the sort of work that came to mind when reading this comment:
|
Now, I get it. 😆 |
Issues without use of
App/src/libs/Navigation/Navigation.js Lines 121 to 125 in 2aaa8fd
We use them for.
Does the latest
|
cc: @marcaaron ⬆️ |
1 similar comment
cc: @marcaaron ⬆️ |
Waiting for further instructions... |
Thanks @parasharrajat! Great overview and appreciate you taking the time to put this together and test out the latest version of
I took a look at Satyajit's response in that first issue and it sounds very reasonable, but also sounds like fixing the browser history isn't a priority yet and the "web support" is still being improved.
Yeah I like this. Upvoting that issue is good. But might also be interesting to try and propose a problem / solution to Problem: Solution: Include a custom action that manages browser history in a predictable way and one that fits the "web" paradigm and more complex navigator setups. Maybe there is some way we can generalize this action so it can work for anyone who experiences this problem? My last remaining concern here is that the custom action we're working on is still super hard to follow - but maybe it would be best to merge this improvement and then I will try to clean it up a bit? |
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.
Ok LGTM and tests well.
There is one issue that I noticed while testing - but it exists on main
already. Reproduction steps:
- Setup web app with more than one chat in LHN
- Navigate to
/
in new tab and ensure there is no history (i.e. cannot press -> in browser) - Open search
- Select chat that is not currently in view
- Press back button
- 💥 - chat does not navigate to previous chat in view
(adding additional pages to the history stack will fix this so seems like it only happens if the very first chat we navigate to after the initial is accessed via the Search
screen)
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Thanks, @marcaaron for the instructions. I would keep an eye on those active issues and Propose a workaround so that it can help others.
Yeah. But I am used to it now. 🤣
I faced it too sometimes but I thought its a development glitch during switching between branches. I will try to debug. Thanks for merging it. |
🚀 Deployed to staging by @marcaaron in version: 1.1.17-8 🚀
|
🚀 Deployed to production by @roryabraham in version: 1.1.18-3 🚀
|
Details
#4756 (comment)
It fixes various issues
Fixed Issues
$ #4756
Tests | QA Steps
Tested On
Screenshots
Web | Desktop
output_file.mp4
output_file.mp4
Mobile Web
output_file.mp4
iOS
Android
output_file.mp4
output_file.mp4