-
Notifications
You must be signed in to change notification settings - Fork 3k
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 - Workflows - Edit approval workflow becomes blank after editing it offline and returning online #51816
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should revert to the draft data
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would it create the same bug?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On failure the workflow changes the user made will be reverted
App/src/libs/actions/Workflow.ts
Lines 144 to 153 in d14b37f
const failureData: OnyxUpdate[] = [ | |
{ | |
onyxMethod: Onyx.METHOD.MERGE, | |
key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, | |
value: { | |
employeeList: previousEmployeeList, | |
pendingFields: {employeeList: null}, | |
...(newDefaultApprover ? {approver: previousDefaultApprover} : {}), | |
}, | |
}, |
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 |
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.
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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