From e6c693f241044bfdcb90d8bf4938dbf7aca795bb Mon Sep 17 00:00:00 2001 From: keyan Date: Fri, 7 Jan 2022 20:05:00 -0600 Subject: [PATCH] don't call localStorage on server --- components/form.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/form.js b/components/form.js index 52668de3..25077f39 100644 --- a/components/form.js +++ b/components/form.js @@ -127,10 +127,10 @@ function InputInner ({ if (overrideValue) { helpers.setValue(overrideValue) if (storageKey) { - localStorage.setItem(storageKey, overrideValue) + localStorage?.setItem(storageKey, overrideValue) } } else if (storageKey) { - const draft = localStorage.getItem(storageKey) + const draft = localStorage?.getItem(storageKey) if (draft) { // for some reason we have to turn off validation to get formik to // not assume this is invalid