Skip to content

Commit 5fccf71

Browse files
committed
#1646: Fix SSR rendering
1 parent 9fd5769 commit 5fccf71

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/Sortable.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* @license MIT
66
*/
77

8+
import './windowCheck.js'; // Always import first
9+
810
import { version } from '../package.json';
911

1012
import { IE11OrLess, Edge, FireFox, Safari, IOS, ChromeForAndroid } from './BrowserInfo.js';
@@ -92,10 +94,6 @@ function _dispatchEvent(info) {
9294
}
9395

9496

95-
if (typeof window === "undefined" || !window.document) {
96-
throw new Error("Sortable.js requires a window with a document");
97-
}
98-
9997
let dragEl,
10098
parentEl,
10199
ghostEl,

src/windowCheck.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
if (typeof window === "undefined" || !window.document) {
2+
throw new Error("Sortable.js requires a window with a document");
3+
}

0 commit comments

Comments
 (0)