Skip to content

Commit 85f3592

Browse files
committed
refactor: should throw errors in computed getters
1 parent 9fd1284 commit 85f3592

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/reactivity/src/effect.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -375,12 +375,13 @@ export function refreshComputed(computed: ComputedRefImpl) {
375375
}
376376
} catch (err) {
377377
dep.version++
378+
throw err
379+
} finally {
380+
activeSub = prevSub
381+
shouldTrack = prevShouldTrack
382+
cleanupDeps(computed)
383+
computed.flags &= ~EffectFlags.RUNNING
378384
}
379-
380-
activeSub = prevSub
381-
shouldTrack = prevShouldTrack
382-
cleanupDeps(computed)
383-
computed.flags &= ~EffectFlags.RUNNING
384385
}
385386

386387
function removeSub(link: Link) {

0 commit comments

Comments
 (0)