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

Migrate usages of AppMountParameters.onAppLeave to use ScopedHistory.block instead #92187

Open
6 tasks
pgayvallet opened this issue Feb 22, 2021 · 3 comments
Open
6 tasks
Labels
chore Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@pgayvallet
Copy link
Contributor

pgayvallet commented Feb 22, 2021

In #91099 we implemented ScopedHistory.block. Now that this API is available, it should be favored for all navigation blocking needs, and be used instead of AppMountParameters.onAppLeave that shall be removed at a later time.

Identified usages:

  • dashboard @elastic/kibana-presentation

useEffect(() => {
if (!dashboardStateManager || !dashboardContainer) {
return;
}
onAppLeave((actions) => {
if (
dashboardStateManager?.getIsDirty() &&
!embeddable.getStateTransfer().isTransferInProgress
) {
return actions.confirm(
leaveConfirmStrings.getLeaveSubtitle(),
leaveConfirmStrings.getLeaveTitle()
);
}
return actions.default();
});

  • visualize @elastic/kibana-app

<Route exact path={`${VisualizeConstants.EDIT_BY_VALUE_PATH}`}>
<VisualizeByValueEditor onAppLeave={onAppLeave} />
</Route>
<Route path={[VisualizeConstants.CREATE_PATH, `${VisualizeConstants.EDIT_PATH}/:id`]}>
<VisualizeEditor onAppLeave={onAppLeave} />
</Route>

  • lens @elastic/kibana-app

onAppLeave((actions) => {
// Confirm when the user has made any changes to an existing doc
// or when the user has configured something without saving
if (
application.capabilities.visualize.save &&
!_.isEqual(state.persistedDoc?.state, getLastKnownDocWithoutPinnedFilters()?.state) &&
(state.isSaveable || state.persistedDoc)
) {
return actions.confirm(

appMountParams.onAppLeave((actions) => actions.default());

  • security_solution @elastic/security-solution

<PageRouter history={history} onAppLeave={onAppLeave}>
{children}
</PageRouter>

@pgayvallet pgayvallet added the Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc label Feb 22, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@pgayvallet
Copy link
Contributor Author

cc @elastic/kibana-presentation @elastic/kibana-app @elastic/ml-ui @elastic/kibana-gis @elastic/security-solution

@nreese
Copy link
Contributor

nreese commented Feb 22, 2021

Created #92196 to track Maps replacement of AppMountParameters.onAppLeave

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

No branches or pull requests

3 participants