From c60c0cc56ce014ca3099655b666a731f9c402a69 Mon Sep 17 00:00:00 2001 From: Ryan Banks Date: Fri, 22 May 2020 12:47:44 -0500 Subject: [PATCH] Check if sideNav is in dom before hiding it Have $CANOPY.hideCanopy check if the sideNav element is undefined or null before attempting to hide it. This is to account for the possiblity that a sapling has removed the sideNav element from the DOM. Signed-off-by: Ryan Banks --- src/CanopyContext.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CanopyContext.js b/src/CanopyContext.js index 14502e869..e7732fa19 100644 --- a/src/CanopyContext.js +++ b/src/CanopyContext.js @@ -71,7 +71,9 @@ export function CanopyProvider({ window.$CANOPY.hideCanopy = () => { const sideNavElement = document.getElementById('root'); - sideNavElement.classList.add('display-none'); + if (sideNavElement) { + sideNavElement.classList.add('display-none'); + } }; window.$CANOPY.setUser = canopyUser => {