Skip to content

Commit 18a2ae5

Browse files
committed
Add window checks to prevent errors in server-side rendering for dropdown positioning and countdown updates
1 parent 9abf1fe commit 18a2ae5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

packages/js.foresight-devtools/src/lit-entry/control-panel/dropdown/base-dropdown.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,10 @@ export abstract class BaseDropdown extends LitElement {
173173
}
174174

175175
protected _positionDropdown() {
176+
if (typeof window === 'undefined') {
177+
return
178+
}
179+
176180
const triggerButton = this.shadowRoot?.querySelector(".trigger-button") as HTMLElement
177181
const dropdownMenu = this.shadowRoot?.querySelector(".dropdown-menu") as HTMLElement
178182

packages/js.foresight-devtools/src/lit-entry/control-panel/element-tab/reactivate-countdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export class ReactivateCountdown extends LitElement {
129129

130130
updateCountdown()
131131

132-
if (this.remainingTime > 0) {
132+
if (this.remainingTime > 0 && typeof window !== "undefined") {
133133
this.intervalId = window.setInterval(updateCountdown, 100)
134134
}
135135
}

0 commit comments

Comments
 (0)