Skip to content

Commit 4a03ced

Browse files
authored
fix: ssr resizeobserver shim (#2859)
* fix: ssr resizeobserver shim * chore: test workflow * fix(tools): path
1 parent e1f9d66 commit 4a03ced

File tree

5 files changed

+14
-35
lines changed

5 files changed

+14
-35
lines changed

.changeset/few-pumpkins-sit.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@patternfly/pfe-tools": patch
3+
"@patternfly/pfe-core": patch
4+
---
5+
6+
SSR: add shim for `ResizeObserver`

.github/workflows/tests.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
- name: Configure node version
7474
uses: actions/setup-node@v4
7575
with:
76-
node-version: '20'
76+
node-version-file: '.nvmrc'
7777
cache: npm
7878

7979
- name: Install dependencies
@@ -100,7 +100,7 @@ jobs:
100100
- uses: actions/checkout@v4
101101
- uses: actions/setup-node@v4
102102
with:
103-
node-version: '20'
103+
node-version-file: '.nvmrc'
104104
cache: npm
105105
- run: npm ci --prefer-offline
106106
- run: npm run build
@@ -110,7 +110,7 @@ jobs:
110110
env:
111111
HOME: /root
112112

113-
- uses: actions/upload-artifact@v2
113+
- uses: actions/upload-artifact@v4
114114
if: always()
115115
with:
116116
name: ${{ env.PLAYWRIGHT_REPORT_DIR }}
@@ -130,7 +130,7 @@ jobs:
130130
steps:
131131
- uses: actions/checkout@v4
132132
- name: Download zipped HTML report
133-
uses: actions/download-artifact@v4.1.7
133+
uses: actions/download-artifact@v4
134134
with:
135135
name: ${{ env.PLAYWRIGHT_REPORT_DIR }}
136136
path: ${{ env.PLAYWRIGHT_REPORT_DIR }}/

core/pfe-core/ssr-shims.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ globalThis.IntersectionObserver ??= ObserverShim;
4141
// @ts-expect-error: this runs in node
4242
globalThis.MutationObserver ??= ObserverShim;
4343
// @ts-expect-error: this runs in node
44+
globalThis.ResizeObserver ??= ObserverShim;
45+
// @ts-expect-error: this runs in node
4446
globalThis.getComputedStyle ??= function() {
4547
return {
4648
getPropertyPriority() {

tools/pfe-tools/ssr/global.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export async function renderGlobal(
88
html: string,
99
importSpecifiers: string[],
1010
): Promise<string> {
11-
await import('./shims.js');
11+
// avoid tsconfig problems
12+
await import(['@patternfly', 'pfe-core', 'ssr-shims.js'].join('/'));
1213
const { ssr } = await import('./ssr.js');
1314
await Promise.all(importSpecifiers.map(x => import(x)));
1415
return ssr(html);

tools/pfe-tools/ssr/shims.ts

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)