Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iframe synchronization not working #65

Open
hahahannes opened this issue Jan 7, 2025 · 2 comments
Open

iframe synchronization not working #65

hahahannes opened this issue Jan 7, 2025 · 2 comments

Comments

@hahahannes
Copy link

hahahannes commented Jan 7, 2025

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.

hahahannes added a commit to hahahannes/kubeflow that referenced this issue Jan 7, 2025
@hahahannes
Copy link
Author

A possible fix can be found here: kubeflow/kubeflow#7670

@hahahannes
Copy link
Author

I know this is hard to reproduce. I can try to record the behavior or providing some images if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant