Skip to content

Commit

Permalink
Merge pull request #636 from Kreijstal/globalThis-not-in-browser
Browse files Browse the repository at this point in the history
check for globalThis.
  • Loading branch information
sanchit3008 authored Nov 25, 2024
2 parents 9b67774 + 9164f1d commit 2629e8b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export function defaultContext(refs: RefValues): Context {
defaultrowNum: 84,
addDefaultRows: 50,
fullscreenmode: true,
devicePixelRatio: (globalThis || window).devicePixelRatio,
devicePixelRatio: (typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : {}).devicePixelRatio,

Check failure on line 230 in packages/core/src/context.ts

View workflow job for this annotation

GitHub Actions / test

Type 'number | undefined' is not assignable to type 'number'.

contextMenu: {},
sheetTabContextMenu: {},
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/components/Sheet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const Sheet: React.FC<Props> = ({ sheet }) => {
if (!data) return;
setContext((draftCtx) => {
if (settings.devicePixelRatio === 0) {
draftCtx.devicePixelRatio = (globalThis || window).devicePixelRatio;
draftCtx.devicePixelRatio = (typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : {}).devicePixelRatio;

Check failure on line 33 in packages/react/src/components/Sheet/index.tsx

View workflow job for this annotation

GitHub Actions / test

Type 'number | undefined' is not assignable to type 'number'.
}
updateContextWithSheetData(draftCtx, data);
updateContextWithCanvas(
Expand Down

0 comments on commit 2629e8b

Please sign in to comment.