Skip to content

Conversation

@MrCoder
Copy link
Contributor

@MrCoder MrCoder commented Jul 13, 2025

No description provided.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Iframe Load Timing Issue

A race condition exists where iframe.contentWindow.getPng() is called before the getPng method is defined within the iframe. The getPng method is only exposed to the iframe's window object after its load event fires. If a user attempts to export, share, or copy an image before the iframe has fully loaded, the call to getPng will fail with a TypeError: getPng is not a function, preventing the action.

src/components/MainHeader.jsx#L26-L28

const iframe = document.getElementById('demo-frame');
// Use the getPng method exposed by the iframe
const pngDataUrl = await iframe.contentWindow.getPng();

src/components/ContentWrap.jsx#L550-L552

async getPngBlob() {
// Use the getPng method exposed by the iframe
const pngDataUrl = await this.frame.contentWindow.getPng();

src/computes.js#L172-L179

window.app = new window.zenuml.default('#mounting-point')
// Expose getPng method to parent window
window.getPng = async function() {
if (window.app) {
return await window.app.getPng();
}
return null;
};

Fix in CursorFix in Web


BugBot free trial expires on July 22, 2025
Learn more in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

@MrCoder MrCoder merged commit 9403ff9 into master Jul 13, 2025
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants