Skip to content

Commit

Permalink
Poll until some size is available instead of skipping
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Jun 16, 2022
1 parent b81cd4b commit cfe8615
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions proxy/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,13 @@ function requestDecisions (scopes, relayStyles) {
return new Promise((resolve, reject) => {
showElement(element)
relayStyles({ visible: true })
setTimeout(() => {
const pollForSize = window.setInterval(() => {
const { width, height } = element.getBoundingClientRect()
relayStyles({ rect: { width, height } })
}, 7)
if (width && height) {
relayStyles({ rect: { width, height } })
window.clearInterval(pollForSize)
}
}, 3)
if (!yes || !no) {
reject(new Error('Could not bind event listeners.'))
return
Expand Down

0 comments on commit cfe8615

Please sign in to comment.