-
Notifications
You must be signed in to change notification settings - Fork 9
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: update successful save redirects [DHIS2-15431] #1218
Conversation
🚀 Deployed on https://pr-1218--dhis2-user.netlify.app |
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.
Tested on Netlify 👍
I noticed "Cancel without saving" would still use history.goBack()
, but because of the way the <Form>
component is designed, there would be some extra steps to refactor. Maybe the <Form>
component could take a navigateToOnCancel
prop
In some way, I can see some merit to using history.goBack()
if you click "Cancel", because it seems a bit like an "undo/go back" action... but maybe navigating to the relevant list view is better and more consistent with the "Save" behavior. What do you think?
Approved because this is also good as-is 🙂
thanks @KaiVandivier! Good catch re: cancel button. I went and made an update to have the cancel navigate back to the main list rather than use TL;DR: I implemented code to deal with this, but it's more of a refactor, so not sure if we want to implement or not. If you have thoughts, or better ideas, let me know. Technical fix To address this, I wanted to determine on the edit page if you had been referred from elsewhere within the app (in which case we could use Unfortunately, I then thought maybe we could just navigate to the edit page and preserve the filter as a parameter (e.g. So, this left me with keeping track of the referral somehow in global state. Since the app was refactored to remove redux, and since I didn't want to add any other global state manager, I've implemented a provider for this. Now, if you click on "edit" from the context menu, it stores information about what list ( UX |
Nice! I think this design is very good, and seems to be fairly simple to implement 🙌 I noticed that clicking on a row in a list view (e.g. opening the "Users" list, then clicking on the name of a user, instead of using context menu) doesn't get the same "referrer" treatment that clicking on the "Edit" button in the context menu does -- I think those behaviors should match One subjective suggestion is to reorganize the Referrer context a bit: I think all the Referrer context pieces could go in one file, and I would call the directory |
This looks like the kind of place that could use user-app/src/pages/UserList/UserTable.js Lines 104 to 110 in a97a5bd
|
Thanks @KaiVandivier 🤦♂️. I think I always click on the context menu and then edit, so I forgot that you can click on the row 😅. Updated to use |
## [1.5.29](v1.5.28...v1.5.29) (2023-09-14) ### Bug Fixes * update successful save redirects [DHIS2-15431] ([#1218](#1218)) ([75d5039](75d5039))
🎉 This PR is included in version 1.5.29 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
I noticed when making some updates in the user app that the redirects after saving a user group or user role did not appear to work (this might be limited to the case of editing a user group/user role related to the current user). Moreover, since they were using
history.goBack()
when successful, these redirects would navigate to the page you were previously on rather than the main menu for the relevant user metadata (users, user groups, or user roles). Since we use deep links, this behaviour seems counter-intuitive (e.g. if I am on dhis2.org and navigate to a user edit page and save, I think this should when successful go to the list of users, not back to dhis2.org)I have used our internal
navigateTo
function which is using history.push()