Skip to content

Commit

Permalink
fix: setTimeout
Browse files Browse the repository at this point in the history
This change is very minor: `setTimeout(..., 0)` and `setImmediate()` are
nearly identical timing. However `setImmediate` is not a browser safe
function and must be manually polyfilled with Webpack 5. There is no
need for this polyfill and `setTimeout(..., 0)` works for or usage here.
  • Loading branch information
icirellik committed Oct 30, 2020
1 parent db80fd1 commit 5534312
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/internal/clientRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function clientRenderer({
const components = Object.entries(modules).reduce(
(moduleMap, [moduleName, Module]: any[]) => {
const Component = (props: Partial<SerializableComponent> = {}) => {
setImmediate(() => {
setTimeout(() => {
if (!props.mountId) {
console.error(
"[@artsy/stitch] Error mounting clientside component: `mountId` is " +
Expand All @@ -37,7 +37,7 @@ export function clientRenderer({
</Wrapper>,
mountPoint
)
})
}, 0)
}

return {
Expand Down

0 comments on commit 5534312

Please sign in to comment.