Inline dialog web items don't update context when navigating to another page

In our app we have configured an inlinedialog web item like so:

        "webItems": [
            {
                "location": "system.content.button",
                "url": "/static/index.html?contentId={content.id}",
                "context": "addon",
                "target": {
                    "type": "inlinedialog",
                    "options": {
                        "width": "450",
                        "height": "70"
                    }
                },
                "icon": {
                    "width": 24,
                    "height": 20,
                    "url": "/static/assets/imgs/documents_icon_toolbox_cloud.svg"
                },
                "name": {
                    "value": "Document toolbox"
                },
                "key": "k15t-docs-document-toolbox-dialog",
                "conditions": [
                    {
                        "condition": "has_page"
                    }
                ]
            }
        ]

The way that this behaves is that if you click on it early in the page loading process, you end up on a non-existing page such as https://cdauth.atlassian.net/plugins/servlet/ac/k15t-scroll-document-versions-for-confluence/k15t-scroll-document-versions-for-confluence__k15t-docs-document-toolbox-dialog?page.id=1804730381&space.key=%7E490128752&content.id=1804730381&content.version=1&page.type=page&page.title=Test%20pages&space.id=1408663554&content.type=page&page.version=1 with an error message.

Later in the page loading process, when you middle-click on the item you still end up on the broken page, but when you left-click on the item, an inline dialog opens and loads an iframe with the specified URL inside it. In our case it looks like this:

If you click on the button again or click somewhere outside of it or keep the mouse cursor outside of it for a couple of seconds, the inline dialog opens. If you click it again soon, it opens again and still shows the same iframe. However, if you leave it closed for like 30 seconds and then open it again, it shows the iframe for a brief moment, then removes the iframe, and then generates it again, reloading the specified URL.

As you can see in the configuration, I have configured the context parameter {content.id} in the iframe URL, which correctly passes the ID of the currently visible page to the iframe. However, if I open the inline dialog on one page and then navigate to another page by using the sidebar (which causes the other page content to be rendered without a proper page reload) and then open the inline dialog again, it is still in the context of the old page. Even when I wait for 30 seconds and then open it again, the iframe is recreated, but the page ID passed to it is still that of the previous page.

What I would expect is that the first time I open the inline dialog on the new page, the iframe is recreated with the new page ID.

For a workaround, I had a look if there is some kind of event that I can listen to to detect the change of context, but I could not find something like that. Maybe someone knows something?

It would also be nice if the web item button didn’t link to a broken URL. I can’t count the number of times that I have clicked on it when the page was not fully loaded yet…

@candid logged as CONFCLOUD-71689

So users click a link / button which looks perfectly normal and then they end up in Nirvana - that is really :sob: