From 5b8999d6c3aa08b786500848e5dd036d377af338 Mon Sep 17 00:00:00 2001 From: Tanner Reits Date: Tue, 18 Jul 2023 10:56:40 -0400 Subject: [PATCH 1/4] `forceUpdate` calls only execute when in a browser env --- src/runtime/update-component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/runtime/update-component.ts b/src/runtime/update-component.ts index d3d1f17e107..6e1a052bf3a 100644 --- a/src/runtime/update-component.ts +++ b/src/runtime/update-component.ts @@ -1,5 +1,5 @@ import { BUILD, NAMESPACE } from '@app-data'; -import { consoleError, doc, getHostRef, nextTick, plt, win, writeTask } from '@platform'; +import { Build, consoleError, doc, getHostRef, nextTick, plt, win, writeTask } from '@platform'; import { CMP_FLAGS, HOST_FLAGS } from '@utils'; import type * as d from '../declarations'; @@ -336,7 +336,7 @@ export const postUpdateComponent = (hostRef: d.HostRef) => { }; export const forceUpdate = (ref: any) => { - if (BUILD.updatable) { + if (BUILD.updatable && Build.isBrowser) { const hostRef = getHostRef(ref); const isConnected = hostRef.$hostElement$.isConnected; if ( From 06ae53369fc25dd90c3e5e080cf9e2774722b29a Mon Sep 17 00:00:00 2001 From: Tanner Reits Date: Tue, 18 Jul 2023 14:55:57 -0400 Subject: [PATCH 2/4] update testing platform build conditionals --- src/runtime/test/globals.spec.tsx | 3 ++- src/testing/platform/testing-build.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/runtime/test/globals.spec.tsx b/src/runtime/test/globals.spec.tsx index 6a12fdb6714..eec804b20f5 100644 --- a/src/runtime/test/globals.spec.tsx +++ b/src/runtime/test/globals.spec.tsx @@ -33,9 +33,10 @@ describe('globals', () => { }); it('build values', () => { - expect(Build.isBrowser).toBe(false); + expect(Build.isBrowser).toBe(true); expect(Build.isDev).toBe(true); expect(Build.isTesting).toBe(true); + expect(Build.isServer).toBe(false) }); it('Env is defined', () => { diff --git a/src/testing/platform/testing-build.ts b/src/testing/platform/testing-build.ts index d0d3197a239..1e1b74a1fc3 100644 --- a/src/testing/platform/testing-build.ts +++ b/src/testing/platform/testing-build.ts @@ -2,7 +2,7 @@ import type * as d from '@stencil/core/internal'; export const Build: d.UserBuildConditionals = { isDev: true, - isBrowser: false, - isServer: true, + isBrowser: true, + isServer: false, isTesting: true, }; From a390e234d69c1b40f54e350cf2a771dd3c5ae274 Mon Sep 17 00:00:00 2001 From: Tanner Reits Date: Tue, 18 Jul 2023 17:03:09 -0400 Subject: [PATCH 3/4] fmt --- src/runtime/test/globals.spec.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/test/globals.spec.tsx b/src/runtime/test/globals.spec.tsx index eec804b20f5..b90b47d318b 100644 --- a/src/runtime/test/globals.spec.tsx +++ b/src/runtime/test/globals.spec.tsx @@ -36,7 +36,7 @@ describe('globals', () => { expect(Build.isBrowser).toBe(true); expect(Build.isDev).toBe(true); expect(Build.isTesting).toBe(true); - expect(Build.isServer).toBe(false) + expect(Build.isServer).toBe(false); }); it('Env is defined', () => { From 8f2845cd002134be8d9c2521b1628c73a5eeb4fe Mon Sep 17 00:00:00 2001 From: Tanner Reits Date: Wed, 19 Jul 2023 13:48:43 -0400 Subject: [PATCH 4/4] fix an e2e test --- test/end-to-end/src/build-data/build-data.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/end-to-end/src/build-data/build-data.spec.ts b/test/end-to-end/src/build-data/build-data.spec.ts index 86829fe633c..0ffe40990f5 100644 --- a/test/end-to-end/src/build-data/build-data.spec.ts +++ b/test/end-to-end/src/build-data/build-data.spec.ts @@ -1,6 +1,7 @@ -import { BuildData } from './build-data'; import { newSpecPage } from '@stencil/core/testing'; +import { BuildData } from './build-data'; + describe('build-data', () => { it('should be a test', async () => { const { root } = await newSpecPage({ @@ -10,7 +11,7 @@ describe('build-data', () => { expect(root).toEqualHtml(`

isDev: true

-

isBrowser: false

+

isBrowser: true

isTesting: true

`);