From 2d09e5a8ef0f74176d4b272764a0ee1e07129bcb Mon Sep 17 00:00:00 2001 From: cesarParra Date: Fri, 6 Dec 2024 08:53:00 -0400 Subject: [PATCH] Updating example to take into account the previous value --- examples/demo-signals/lwc/demoSignals/error-handler.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/demo-signals/lwc/demoSignals/error-handler.js b/examples/demo-signals/lwc/demoSignals/error-handler.js index dedd585..b627b59 100644 --- a/examples/demo-signals/lwc/demoSignals/error-handler.js +++ b/examples/demo-signals/lwc/demoSignals/error-handler.js @@ -8,10 +8,13 @@ $computed( throw new Error("An error occurred during a computation"); }, { - errorHandler: (error) => { + errorHandler: (error /*_previousValue*/) => { console.error("error thrown from computed", error); // Allows for a fallback value to be returned when an error occurs. return 0; + + // The previous value can also be returned to keep the last known value. + // return previousValue; } } );