From 5534312fe690e3c8f6beab62f3129503a6316b38 Mon Sep 17 00:00:00 2001 From: Cameron Rollheiser Date: Fri, 30 Oct 2020 16:07:42 -0400 Subject: [PATCH] fix: setTimeout 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. --- src/internal/clientRenderer.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/internal/clientRenderer.tsx b/src/internal/clientRenderer.tsx index 70aa4ac..87f6a99 100644 --- a/src/internal/clientRenderer.tsx +++ b/src/internal/clientRenderer.tsx @@ -13,7 +13,7 @@ export function clientRenderer({ const components = Object.entries(modules).reduce( (moduleMap, [moduleName, Module]: any[]) => { const Component = (props: Partial = {}) => { - setImmediate(() => { + setTimeout(() => { if (!props.mountId) { console.error( "[@artsy/stitch] Error mounting clientside component: `mountId` is " + @@ -37,7 +37,7 @@ export function clientRenderer({ , mountPoint ) - }) + }, 0) } return {