Closed gorbunkov closed 2 months ago
Jmix version: 2.3.0-RC1
Probably after changes made in https://github.com/jmix-framework/jmix/issues/3157, AfterNavigationHandler started being invoked before the ReadyEvent handler.
AfterNavigationHandler
ReadyEvent
Suppose, you open the View2 view with the code like this:
View2
viewNavigators.view(this, View2.class) .withAfterNavigationHandler(view2AfterViewNavigationEvent -> { View2 view2 = view2AfterViewNavigationEvent.getView(); view2.setData("aaa"); }) .navigate();
and the View2 looks as follows:
@Route(value = "View2", layout = MainView.class) @ViewController("View2") @ViewDescriptor("View2.xml") public class View2 extends StandardView { private static final Logger log = LoggerFactory.getLogger(View2.class); @Subscribe public void onBeforeShow(final BeforeShowEvent event) { log.info("onBeforeShow"); } @Subscribe public void onReady(final ReadyEvent event) { log.info("onReady"); } public void setData(String aaa) { log.info("setData invoked"); } }
The setData() method (from the withAfterNavigationHandler) is invoked before the onReady(...).
setData()
withAfterNavigationHandler
onReady(...)
The code from withAfterNavigationHandler(...) must be invoked after all view lifecycle events, i.e. setData() must be invoked after the onReady()
withAfterNavigationHandler(...)
onReady()
untitled55.zip
Tested on Jmix version: 2.3.999-SNAPSHOT Jmix Studio plugin version: 2.3.SNAPSHOT6567-241 IntelliJ version: IntelliJ IDEA 2024.1.1
Environment
Jmix version: 2.3.0-RC1
Bug Description
Probably after changes made in https://github.com/jmix-framework/jmix/issues/3157,
AfterNavigationHandler
started being invoked before theReadyEvent
handler.Suppose, you open the
View2
view with the code like this:and the View2 looks as follows:
Current Behavior
The
setData()
method (from thewithAfterNavigationHandler
) is invoked before theonReady(...)
.Expected Behavior
The code from
withAfterNavigationHandler(...)
must be invoked after all view lifecycle events, i.e.setData()
must be invoked after theonReady()
Sample Project
untitled55.zip