Skip to content

Commit 0ebba9a

Browse files
Merge pull request #64 from aga5tya/fix-server-window-error
fix(ssr): change the way window object was defensively checked.
2 parents 6f95602 + 59d28c2 commit 0ebba9a

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/VirtualList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ var VirtualList = function VirtualList(options) {
7070
_this.refreshState = _this.refreshState.bind(_this);
7171

7272
// if requestAnimationFrame is available, use it to throttle refreshState
73-
if (window && 'requestAnimationFrame' in window) {
73+
if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) {
7474
_this.refreshState = (0, _throttleWithRAF2.default)(_this.refreshState);
7575
}
7676
return _this;

src/VirtualList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const VirtualList = (options, mapVirtualToProps = defaultMapToVirtualProps) => (
4242
this.refreshState = this.refreshState.bind(this);
4343

4444
// if requestAnimationFrame is available, use it to throttle refreshState
45-
if (window && 'requestAnimationFrame' in window) {
45+
if (typeof window !== 'undefined' && 'requestAnimationFrame' in window) {
4646
this.refreshState = throttleWithRAF(this.refreshState);
4747
}
4848
};

0 commit comments

Comments
 (0)