]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
refactor: should throw errors in computed getters
authorEvan You <yyx990803@gmail.com>
Wed, 24 Apr 2024 09:27:51 +0000 (17:27 +0800)
committerEvan You <yyx990803@gmail.com>
Wed, 24 Apr 2024 09:27:51 +0000 (17:27 +0800)
packages/reactivity/src/effect.ts

index 90db99cf77f95d4e2046c5fb6c6d7d60cb76e867..e361e85404021ae56b7e9234c9023c13f888131e 100644 (file)
@@ -375,12 +375,13 @@ export function refreshComputed(computed: ComputedRefImpl) {
     }
   } catch (err) {
     dep.version++
+    throw err
+  } finally {
+    activeSub = prevSub
+    shouldTrack = prevShouldTrack
+    cleanupDeps(computed)
+    computed.flags &= ~EffectFlags.RUNNING
   }
-
-  activeSub = prevSub
-  shouldTrack = prevShouldTrack
-  cleanupDeps(computed)
-  computed.flags &= ~EffectFlags.RUNNING
 }
 
 function removeSub(link: Link) {