-
Notifications
You must be signed in to change notification settings - Fork 0
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
chore(ami): drop unused assets, save new snippets #421
base: main
Are you sure you want to change the base?
chore(ami): drop unused assets, save new snippets #421
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent! I added a comment butt leave it up to you if you wanna add it in.
iframe.addEventListener('load', () => setupResizeObserver(iframe)); | ||
} | ||
window.addEventListener('resize', () => debouncedResizeIframe(iframe)); | ||
</script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ended up adding this line as well, because the iframe content can take a few seconds to populate and kept getting inconsistent resizing behavior, often having to trigger a resize event to get the redraw to take. This seems to properly trigger it without having to touch anything.
window.addEventListener('load', () => window.dispatchEvent(new Event('resize')));
Note: There are still some load time issues from the upstream end, right now it can be up to 6 seconds before the iframe fully 'loads'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Doesn't hurt, but I think we're still fighting race condition, cuz iFrame content (not part of this window) can load after window load.
I think what we really need is the iFrame content (i.e. every app) to dispatch that event to it's parent doc when it actually "loads".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or a custom event to which we also listen. Google says window.parent.dispatchEvent(ourEvent);
. And it seems simple to create a custom event.
Following up here... I requested the following code be added to the upstream iframe generated by the Dash app:
Then in the CMS template we should be able to resize accordingly when we intercept the events:
Note: There is a dash-extensions component named |
Overview & Changes
Related
Testing & UI
N/A
Notes
These
iframe-…
snippets deserve to become a new TACC/Core-CMS template.