Skip to content

Commit

Permalink
fix: don't replace onload callback on original style elements
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisvxd committed Apr 17, 2024
1 parent 743d60a commit c8e1b61
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/AutoFrameComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,14 @@ const CopyHostStyles = ({
let styleSheet = getStyleSheet(el);

if (!styleSheet) {
await new Promise((resolve) => (el.onload = resolve));
await new Promise<void>((resolve) => {
const fn = () => {
resolve();
el.removeEventListener("load", fn);
};

el.addEventListener("load", fn);
});
styleSheet = getStyleSheet(el);
}

Expand Down

0 comments on commit c8e1b61

Please sign in to comment.