Fix - Workflows - Edit approval workflow becomes blank after editing it offline and returning online#51816
Conversation
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: ONYXKEYS.APPROVAL_WORKFLOW, | ||
| value: {...approvalWorkflow, isLoading: false}, | ||
| }, |
There was a problem hiding this comment.
I think we should revert to the draft data
There was a problem hiding this comment.
Nope. It would create the same bug as the current issue but on the failing of the API request instead of the current issue that is happening on success.
There was a problem hiding this comment.
Why would it create the same bug?
There was a problem hiding this comment.
We are adding the info back so the user can fix the mistakes.. Speaking of mistakes, do you know if this API can return errors and where are they being displayed as currently it does not seem we can access that workflow page without overwriting its data first
There was a problem hiding this comment.
@s77rt we always load the draft with the current workflow when we open an edit workflow page (we need to save the draft approval workflow because we have different sub-pages in the workflow edit flow) so let's say the user is editing a different workflow when the previous save API fails so you are suggesting to revert the previous draft workflow which is wrong.
There was a problem hiding this comment.
I see what you are saying but what if the API request failed? How is the user supposed to know that it failed? Or is this not supposed to happen?
There was a problem hiding this comment.
On failure the workflow changes the user made will be reverted
App/src/libs/actions/Workflow.ts
Lines 144 to 153 in d14b37f
but approvalWorkflow, as I clearly indicated in my proposal, is the onyx key we use to save temporary draft workflow that we are editing and we don't need to revert that onFailure. Is it clear now?
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromemweb-chrome.moviOS: Nativeios.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
neil-marcellini
left a comment
There was a problem hiding this comment.
Great work thanks. I noticed we have a bug on main and this branch where the not found page flashes. Would you please report that bug if one doesn't already exist for it?
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
It's already here @neil-marcellini |
|
🚀 Deployed to staging by https://github.com/neil-marcellini in version: 9.0.57-0 🚀
|
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.0.57-10 🚀
|

Details
Fixed Issues
$ #51468
PROPOSAL: #51468 (comment)
Tests
Offline tests
Same as above
QA Steps
Same as above
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
2024-10-31.21-31-48.mp4
Android: mWeb Chrome
aw.mp4
iOS: Native
i.mp4
iOS: mWeb Safari
iw.mp4
MacOS: Chrome / Safari
w.mp4
MacOS: Desktop
d.mp4