From e6a04f3837d8c7fba9b5e2455d9a7c8dd7ccac13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serkan=20Yer=C5=9Fen?= Date: Thu, 20 May 2021 15:33:05 -0700 Subject: [PATCH] make sure wrapper is found before accessing the classList When used with https://github.com/pmmmwh/react-refresh-webpack-plugin this error shows up during incremental builds. ```Cannot read property 'classList' of null``` --- lib/client/overlays/progress-minimal.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/client/overlays/progress-minimal.js b/lib/client/overlays/progress-minimal.js index c50cfe5..ea451d0 100644 --- a/lib/client/overlays/progress-minimal.js +++ b/lib/client/overlays/progress-minimal.js @@ -95,7 +95,9 @@ const init = (options, socket) => { const percent = Math.floor(data.percent * 100); const wrapper = document.querySelector(`#${ns}`); - wrapper.classList.remove(`${ns}-hidden`, `${ns}-disappear`); + if (wrapper) { + wrapper.classList.remove(`${ns}-hidden`, `${ns}-disappear`); + } if (data.percent === 1) { if (document.hidden) {