Skip to content

Implement ‘Leave’ functionality on CSV Pages’ Unsaved Warning Component #1517

@aduques

Description

@aduques

Is your feature request related to a problem? Please describe.

This feature request is related to the unsaved warning component implementation done in Issue #1191. Issue #1191 involves implementing the unsaved warning component on the CSV Readings and CSV Meters pages, but the functionality is not complete. The functionality of the unsaved warning component is complete on the other Edit/Create pages, as they are designed differently than the CSV pages (create/edit pages being modals). Therefore, the functionality could not be simply carried over to the CSV pages.

When clicking on the Unsaved Warning Component’s ‘Leave’ button, instead of rerouting the user to the page that they attempted to go to before being stopped by the unsaved warning, the warning is closed, and the user has to attempt to go to the page that they were previously attempting to go to.

Describe the solution you'd like

Instead of having the user needing to perform the action again (make changes -> attempt to go to another page -> unsaved warning pop up -> press ‘Leave’ -> closes out of unsaved warning -> attempt to go to another page -> successfully went to different page), the user should be redirected to the desired page upon pressing ‘Leave.’

Describe alternatives you've considered

useNavigator() was considered to store the URL path of the attempted page. When the user presses ‘Leave,’ the saved URL path is supposed to be fetched, and that is where the user will be rerouted immediately.

In other words, pressing ‘Leave’ is supposed to go to the page of the saved URL path.

Additional context

Previous discussions on attempted solutions to this issue can be found on Issue #1191 and Pull Request #1504. See the commit history of #1504, for commented-out attempts of using useNavigator() as a possible solution.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions