Skip to content

Commit

Permalink
Update signal.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishiv committed Aug 21, 2024
1 parent 51ba28f commit a4d4882
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/state/signal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const createSignal = <T = any>(val: T): Signal<T> => {
}

function set(value: T) {
if (sig.value === value) return value;
sig.value = value;
runWires(sig.wires);
return val;
Expand All @@ -44,7 +45,7 @@ export const createComputedSignal = <T = any>(wire: Wire<T>) => {
const value = wire.run();
const signal = createSignal<T>(value);
const handler = () => {
signal.set(wire.value as T);
if (signal.get() !== wire.value) signal.set(wire.value as T);
};
wire.tasks.add(handler);
return signal;
Expand Down

0 comments on commit a4d4882

Please sign in to comment.