Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-139800

Liferay.Session.extend() is registering the session banner many times

    Details

      Description

      JS API to extend session is typically used by DXP applications which may take a long time to interact with the server, thus risking server session being expired. This is very well illustrated in LPS-134283 description.

      The Liferay.Session manages a banner which is now implemented via openToast() function to inform user about session warning/expiration. Upon session extension, that banner is destroyed in case it was being displayed. In this process, we are not properly managing the toast component and thus we can see a console message:

      Component with id "sessionToast" is being registered twice. This can lead to unexpected behaviour in the "Liferay.component" and "Liferay.componentReady" APIs, as well as in the "*:registered" events.

      This may prevent DXP apps to use this API (see LPS-137506)

      Steps to reproduce

      1. Log in in a DXP instance. Make sure Remember Me is not checked
      2. Open the devtools console
      3. Type Liferay.Session.extend() to trigger a session extension. This is expected to be done by DXP Applications, we're emulating this via console
      4. Repeat step 3. From now on, console will display the error message as shown in the picture

        Attachments

          Activity

            People

            Assignee:
            team-frontend-infra Product Team Frontend Infrastructure
            Reporter:
            daniel.sanz Daniel Sanz
            Participants of an Issue:
            Recent user:
            Sophia Zhang
            Engineering Assignee:
            Marko Čikoš
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              7 weeks, 6 days ago

                Packages

                Version Package
                7.4.13 DXP GA1
                7.4.3.4 CE GA4
                Master