Skip to content

Commit 96c45ab

Browse files
authored
Merge pull request #2829 from patternfly/fix/core/internals-ssr
fix(core): make internals controller ssrable
2 parents bce98d2 + 63b66e6 commit 96c45ab

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

.changeset/thin-aliens-smoke.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
"@patternfly/pfe-core": patch
3+
---
4+
`InternalsController`: prevent Safari-detector from breaking SSR

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
name: SSR Tests (Playwright)
9696
runs-on: ubuntu-latest
9797
container:
98-
image: mcr.microsoft.com/playwright:v1.45.1-jammy
98+
image: mcr.microsoft.com/playwright:v1.46.1-jammy
9999
steps:
100100
- uses: actions/checkout@v4
101101
- uses: actions/setup-node@v4

core/pfe-core/controllers/internals-controller.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ export class InternalsController implements ReactiveController, ARIAMixin {
8383
return Array.from(this.instances.get(host)?.internals.labels ?? []) as Element[];
8484
}
8585

86-
public static isSafari: boolean = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
86+
public static isSafari: boolean =
87+
!isServer && /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
8788

8889
public static of(
8990
host: ReactiveControllerHost,

0 commit comments

Comments
 (0)