Reload view once modal is confirmed and show notification

Hey, I want to reload page, and after the page is reloaded then I want to show notification. It works but it seems that Notification is shown immediately (no wait to reload the view) after the modal dialog is closed. Then page is reloaded so notification is dismissed even if the code looks like below. How to reload the page and then show notification that stays on for default 5 seconds?

private void submitModalForm() {

You have to delay your call to show notification until the “new page” is loaded. No there is no such hook because reload() is a rarely used function and not recommended in a default workflow

hmm is there a better way to refresh view than UI.reload? My view has n buttons that are enabled/disabled based on configuration taken from database. When user clicks button, modal window is open with the form that user can fill out and submit. Once the form is submitted I need to update some record in database to tell the view that clicked button must be disabled from now (user shouldn’t be able to click the same button again after form submission). Now when the form is submitted and modal window closed notification is shown but the button is still enabled until I reload the page - when reload is triggered then the view is rendered again and button is disabled. So how to properly reload the view?

Just call a function on the view that reloads the buttons, there is no need to rebuild the whole UI just to update some state of buttons. If you don’t have direct access from within your dialog to your view you can e.g. use the EventBus - using reload() literally is the worst option for such a simple task because it recreates the whole server side and client side of all attached components

yeah I thought that reload() isn’t a good option. Exactly, I do not have direct access from my dialog. I’m going to examine ui event bus as you recommended. Thanks!