Logout failing after migrating from 2.4.2 to 2.4.3

Jmix framework: 2.4.3
Jmix studio: 2.4.2
IntelliJ idea Ultimate 2024.3.2.1

After migrating an application from 2.4.2 to 2.4.3 clicking the logout button simply does nothing anymore. I migrated two other applications in the same way. The issue does occur in one only - but I have no idea why. I used the browser console to investigate what’s happening.

The only thing I notice and sounds a bit suspicious is: jmixBeforeUnloadListener ist not defined

See this screenshot with the console output of a plainly generated application (generated user entity only) after logging out successful:
243_logout_playground

And this one, where the logout button simply seems to do nothing:
243_logout_inop

Could you support giving me further investigation hints?

Hi,

The index.html file of your project must contain the jmixBeforeUnloadListener function definition for the correct work of prevent browser tab closing functionality:

<html lang="en">
<head>
  <script type="text/javascript">
    jmixBeforeUnloadListener = (event) => {
      event.preventDefault();
      return (event.returnValue = "");
    };
  </script>
   ...
</html>

Regards,
Gleb

1 Like

@gorelov Thank you. That indeed solved the logout error.

It seems a bit strange because the JavaScript section is missing since I migrated the application to Jmix 2.0 more than one year ago. The logout error just appeared after minor migration step from 2.4.2 to 2.4.3.

I synchronized the index.html file with the one of a newly generated empty project.

@gorelov
This is very strange to me too.

With all my projects which I did migrate from 2.4.4 to 2.5 I had the same issue !!

I think you should check, when and how this index.html is generated, even more, as the directory of this one too did change from the frontend dir to /src/main/frontend !!

Regards

Felix