From 28af59a4cabac975e0c3b46e33acef65a7209e3d Mon Sep 17 00:00:00 2001 From: dominikg Date: Sun, 29 May 2022 21:31:36 +0200 Subject: [PATCH] fix: set default value for option.optimistic to false to prevent fatal runtime errors breaking the page --- .changeset/spotty-garlics-exist.md | 5 +++++ packages/svelte-hmr/lib/make-hot.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/spotty-garlics-exist.md diff --git a/.changeset/spotty-garlics-exist.md b/.changeset/spotty-garlics-exist.md new file mode 100644 index 0000000..745c29d --- /dev/null +++ b/.changeset/spotty-garlics-exist.md @@ -0,0 +1,5 @@ +--- +'svelte-hmr': patch +--- + +change options.optimistic default value from true to false to fix buggy behavior on fatal runtime errors diff --git a/packages/svelte-hmr/lib/make-hot.js b/packages/svelte-hmr/lib/make-hot.js index d774e49..64daa7c 100644 --- a/packages/svelte-hmr/lib/make-hot.js +++ b/packages/svelte-hmr/lib/make-hot.js @@ -18,7 +18,8 @@ const defaultHotOptions = { // don't reload on fatal error noReload: false, // try to recover after runtime errors during component init - optimistic: true, + // defaults to false because some runtime errors are fatal and require a full reload + optimistic: false, // auto accept modules of components that have named exports (i.e. exports // from context="module") acceptNamedExports: true,