From e4866ad32c5b1ccd5f2bb60ad69945e583f1b765 Mon Sep 17 00:00:00 2001 From: Assim EL HAMMOUTI Date: Tue, 24 Sep 2019 21:24:36 +0200 Subject: [PATCH] fix: check `window` is defined before using it (#962) --- packages/graphiql/src/utility/StorageAPI.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/graphiql/src/utility/StorageAPI.js b/packages/graphiql/src/utility/StorageAPI.js index 86ef9c0180f..02f77cb708e 100644 --- a/packages/graphiql/src/utility/StorageAPI.js +++ b/packages/graphiql/src/utility/StorageAPI.js @@ -7,7 +7,8 @@ export default class StorageAPI { constructor(storage) { - this.storage = storage || window.localStorage; + this.storage = + storage || (typeof window !== 'undefined' ? window.localStorage : null); } get(name) {