Skip to content

iframe synchronization not working #65

@hahahannes

Description

@hahahannes

Hello!

I am running the latest version of the central dashboard (from https://github.com/kubeflow/kubeflow/tree/master/components/centraldashboard). I am facing a strange situation where the synchronization of my iframe is not working correctly.

My setup:
I am running the dashboard locally with Docker with an externalLink pointing to /models. All the requests with this prefix go though an nginx and will be redirected to a MlFlow instance. This works well.
Next, I am using a custom authentication plugin which will serve an Angular application behind /models/oidc/ui. As soon as I navigate to pages of the plugin, the synchronization does not work correctly. Sometimes the URL of the dashboard does not reflect the URL of the iframe by either not updating or by changing to a wrong URL which will lead to a 404.

Details
How I understand the synchronization:
Sync from iFrame to parent:

  • click and hashchange eventlistener capture changes in the iframe location
  • the location is compared with a previous stored location in the this.page variable
  • if the location changed:
    • this triggers _routePageChanged which will change the window history
    • which will lead to an updated location in the browser as well and the parent hash
    • the hash change then triggers _routePageChanged again
  • if the location did not change, nothing happens

Sync from parent to iframe:

  • everytime the location of the parent frame changes, _iframePageChanged is triggered
  • this will trigger _srcChanged to actually change the iframe src

Steps to reproduce

  • Run an iFrame with a link to a new page (making a GET request, no client side routing)
  • Click the link

Expected Behavior:
The URL of the dashboard should reflect the URL of the iFrame.

Observed Behavior:
The URL of the dashboard does not reflect the URL of the iFrame.

Solution
The problem does not occur when I remove the routeHash change in _iframePageChanged. The change of the hash is reflected by the window history replacement anyways, so it seems like it can be removed.
I further had to change the load event listener of the IframeContainer to set the current page each time the iframe is loaded.
To me it seems that there might be a timing issue with the click event listener and the page load.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions