Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-58565

Web Panels in Confluence are loaded multiple times if you go to a Space Overview directly

    XMLWordPrintable

Details

    Description

      Summary

      This was reported to Wittified by a customer of Announcer for Confluence Cloud (JST-352300). We've tracked it down to being a connect issue where the web-panels are being loaded multiple times if you go to the Overview and Pages landing pages of a Space as a first "click" into a space.

      Steps to Reproduce

      1. Got directly to the Overview URL

      Or

      1. While in Space Overview, reload the page

      Expected Results

      Consistently render the web panel once.

      Actual Results

      App is being shown twice.

      Notes

      We recreated this by creating an app at https://objects-us-west-1.dream.io/wittified-general/confluence-web-panels/atlassian-connect.json

      The descriptor:

      {
        "key": "my-add-on",
        "name": "Ping Pong",
        "description": "My very first add-on",
        "vendor": {
          "name": "Angry Nerds",
          "url": "https://www.atlassian.com/angrynerds"
        },
        "baseUrl": "https://objects-us-west-1.dream.io/wittified-general/confluence-web-panels",
        "links": {
          "self": "https://objects-us-west-1.dream.io/wittified-general/confluence-web-panels/atlassian-connect.json",
          "homepage": "https://objects-us-west-1.dream.io/wittified-general/confluence-web-panels/atlassian-connect.json"
        },
        "authentication": {
          "type": "none"
        },
        "scopes": [
          "READ"
        ],
        "modules": {
          "webPanels": [
            {
              "url": "/web-panel.html",
              "location": "atl.general",
              "weight": 10,
              "name": {
                "value": "Some name"
              },
              "key": "web-panel"
            }
          ]
        }
      }
      

      The html of /web-panels

      <html>
      	<head>
      		<script>
      		
        // fn to grab query params from url
        function getParameterByName(name) {
          name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
          var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
              results = regex.exec(location.search);
          return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
        }
      
       var head = document.getElementsByTagName("head")[0];
      
      var hostBaseUrl = getParameterByName('xdm_e') + getParameterByName('cp');
      
          var script = document.createElement("script");
          script.type = "text/javascript";
          script.src = hostBaseUrl +'/atlassian-connect/all.js';
          script.setAttribute('data-options','base:true')
          script.onreadystatechange = function () {
            if (this.readyState == 'complete') {
              main();
            }
          };
          head.appendChild(script);
      </script>
      </head>
      <body>
      <script>alert('loaded the atl.general location');</script>
      	<div class="ac-content">
      		This should only be shown once!
      	</div>
      </body>
      </html>
      

      The end result should be that you should only get 1 alert with 'loaded the atl.general location' appearing and the text of 'This should only be shown once!'

      However the end result is if you go to the Space Overview of Space directly(see entry-space.mp4) - you get the alert twice and 'This is should only be shown once!' is rendered twice on the page. The Connect framework is confused at this point because there are 2 iframes and don't stop the Loading Spinner. If we go to a Page by clicking through the navigation and then navigate back to the Overview page - then it works. It's only the first load.
      If we go to a Page directly(see entry-page.mp4) and then go to the Space Overview - everything is working properly.

      Attachments

        Issue Links

          Activity

            People

              rtalusan Ryan Talusan
              6e09b0ca9c15 Daniel Wester
              Votes:
              6 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: