Skip to content
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

Core's navigate to return the navigation result #2257

Closed
aartek opened this issue Sep 3, 2021 · 4 comments · Fixed by #2509
Closed

Core's navigate to return the navigation result #2257

aartek opened this issue Sep 3, 2021 · 4 comments · Fixed by #2509
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@aartek
Copy link
Contributor

aartek commented Sep 3, 2021

Description
Navigation using core's Luigi.navigation().navigate() can be stopped if unsaved changes warning modal is displayed and dismissed. Because of that It's hard to perform any action after changing the route - in our case we need to call Luigi.reset() when the route is changed. It would be great if Luigi.navigation().navigate() returned boolean result depends of navigation success.

Then we could do

if (Luigi.navigation().navigate(...)){
    Luigi.reset()
}

Reasons

  • add ability to perform action after successful route change
@hardl hardl added this to the Sprint 21 milestone Sep 6, 2021
@hardl hardl added the enhancement New feature or request label Sep 6, 2021
@rafalgamon rafalgamon self-assigned this Sep 27, 2021
@JohannesDoberer JohannesDoberer added the WIP Work in progress label Sep 28, 2021
@JohannesDoberer
Copy link
Contributor

Need some clarification first from Philipp

@JohannesDoberer JohannesDoberer modified the milestones: Sprint 21, Sprint 22 Nov 3, 2021
@hardl hardl removed the WIP Work in progress label Dec 10, 2021
@hardl
Copy link
Contributor

hardl commented Dec 10, 2021

@aartek since the whole navigation mechanism includes a lot of nested asynchronous calls, it is not possible to simply return a boolean.
The proposed solution would be that the navigate function returns a promise, so you could implement your logic from above like

Luigi.navigation().navigate(...).then(() => {
    Luigi.reset()
});

@aartek
Copy link
Contributor Author

aartek commented Jan 20, 2022

@hardl this will be fine. Do you plan to work on this soon?

@hardl
Copy link
Contributor

hardl commented Jan 20, 2022

@aartek there is already a draft PR https://github.com/SAP/luigi/pull/2417/files, which is waiting to be picked up by someone from the team, so i guess it should be finished soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants