onBeforeShow weird behavior

Hi,
Inside the onBeforeShow listenner of an edit screen, if I modify the editedEntity, the changes are made on the parent browser screen. This is very confusing. In over a year working with Jmix I never noticed that and there is no information about that in the documentation. I think that editedEntity should represent the instance we are editing in the screen OR be null before it’s initialization.

step to reproduce:

  1. add a onBeforeShow in any editor screen (let’s use UserEdit)
    @Subscribe
    private fun onBeforeShow(event: BeforeShowEvent) {
        editedEntity.firstName = "foo"
    }
  1. run the app → open a browser → edit an entity (the changes done in onBeforeShow are not visible)
  2. go back to the browser screen by clicking the cancel button (the changes are visible)

best regards

Hi,

Thank you for reporting the problem, I’ve created a GitHub issue.

Regards,
Gleb

1 Like