Skip to content

Commit 552f40a

Browse files
committed
Fix: added window existence check
1 parent 398356e commit 552f40a

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Run `bun i @mezh-hq/react-seat-toolkit` to incorporate into your project <br/>
8888
```jsx
8989
import React from 'react';
9090
import SeatToolkit from '@mezh-hq/react-seat-toolkit';
91+
import '@mezh-hq/react-seat-toolkit/styles';
9192

9293
const App = () => {
9394
const data = {
@@ -125,6 +126,7 @@ export default App;
125126
```jsx
126127
import React from 'react';
127128
import SeatToolkit from '@mezh-hq/react-seat-toolkit';
129+
import '@mezh-hq/react-seat-toolkit/styles';
128130

129131
const App = () => {
130132
return (

src/utils/workspace.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ export const getWorkspaceHeight = () => {
1212

1313
export const getWorkspaceCenterX = () => {
1414
const workspaceContainer = document.getElementById(ids.workspaceContainer);
15+
if (typeof window === "undefined") return 0;
1516
return window.innerWidth / 2 - (workspaceContainer?.offsetLeft ?? 0) - 8;
1617
};
1718

1819
export const getWorkspaceCenterY = () => {
1920
const workspaceContainer = document.getElementById(ids.workspaceContainer);
21+
if (typeof window === "undefined") return 0;
2022
return window.innerHeight / 2 - (workspaceContainer?.offsetTop ?? 0);
2123
};

0 commit comments

Comments
 (0)