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: call every contribution on unload #8863

Merged
merged 1 commit into from
Dec 16, 2020
Merged

Conversation

paul-marechal
Copy link
Member

The current procedure bails early on the first contribution that
prevents unloading. This means that other contributions are not
notified.

This commit makes sure that all contributions are called.

Signed-off-by: Paul Maréchal [email protected]

How to test

Review checklist

Reminder for reviewers

@paul-marechal paul-marechal added core issues related to the core of the application enhancement issues that are enhancements to current functionality - nice to haves labels Dec 14, 2020
@kittaakos
Copy link
Contributor

How to test

How to test it?

@colin-grant-work
Copy link
Contributor

colin-grant-work commented Dec 15, 2020

I thought your explanation in the other PR about onWillStop not being for cleanup code was good enough for me. Maybe we should just update the javadoc here to emphasize that onStop should perform cleanup and onWillStop is only for preventing the stop:

/**
* Called on `beforeunload` event, right before the window closes.
* Return `true` in order to prevent exit.
* Note: No async code allowed, this function has to run on one tick.
*/
onWillStop?(app: FrontendApplication): boolean | void;
/**
* Called when an application is stopped or unloaded.
*
* Note that this is implemented using `window.beforeunload` which doesn't allow any asynchronous code anymore.
* I.e. this is the last tick.
*/
onStop?(app: FrontendApplication): void;

@paul-marechal paul-marechal force-pushed the mp/onWillStop branch 2 times, most recently from 6a60da7 to a8d5810 Compare December 15, 2020 15:56
@paul-marechal
Copy link
Member Author

@kittaakos I added a unit test, thanks for reminding me!

@paul-marechal
Copy link
Member Author

@colin-grant-work Right, we can either call everyone or not, but it seems to make more sense to call everyone. At least it would be a fair expectation from something called onWillStop.

The current procedure bails early on the first contribution that
prevents unloading. This means that other contributions are not
notified.

This commit makes sure that all contributions are called.

Signed-off-by: Paul Maréchal <[email protected]>
@paul-marechal paul-marechal merged commit 16ad46a into master Dec 16, 2020
@paul-marechal paul-marechal deleted the mp/onWillStop branch December 16, 2020 19:22
@github-actions github-actions bot added this to the 1.9.0 milestone Dec 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core issues related to the core of the application enhancement issues that are enhancements to current functionality - nice to haves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants