Skip to content

Commit

Permalink
Merge pull request #9 from 1000hz/fix-blocking-pending-scripts
Browse files Browse the repository at this point in the history
fix: append pending inline text only after unblocked
  • Loading branch information
DylanPiercey authored Nov 26, 2024
2 parents 020d50b + dd14cd5 commit 1aa87fb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,13 @@ export = function writableDOM(
}
},
close() {
appendInlineTextIfNeeded(pendingText, inlineHostNode);

return isBlocked
const promise = isBlocked
? new Promise<void>((_) => (resolve = _))
: Promise.resolve();

return promise.then(() => {
appendInlineTextIfNeeded(pendingText, inlineHostNode);
});
},
};

Expand Down

0 comments on commit 1aa87fb

Please sign in to comment.