Skip to content

How can I stop reacting to a signal update? #655

Answered by atk
danieltroger asked this question in Q&A

You must be logged in to vote

You can use a derived memo:

const [source, setSource] = createSignal(false);
let switchDone = false;
const target = createMemo(() => switchDone || (switchDone = source()));

Update: since source() will only be called off switchDone is false, we can omit untrack.

Replies: 2 comments 3 replies

You must be logged in to vote
2 replies
@danieltroger

@danieltroger

Answer selected by danieltroger

You must be logged in to vote
1 reply
@atk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants