Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REPL: Bug with effect & useSignalEffect tracking #1180

Open
rschristian opened this issue Sep 23, 2024 · 0 comments
Open

REPL: Bug with effect & useSignalEffect tracking #1180

rschristian opened this issue Sep 23, 2024 · 0 comments

Comments

@rschristian
Copy link
Member

rschristian commented Sep 23, 2024

Not quite sure of the cause & don't have time to chase it down yet, but the tracking of dependencies in effect and useSignalEffect seems to be a bit broken in the context of our REPL. For example, here's a lazy effect:

import { signal, effect, useSignalEffect } from '@preact/signals';

const count = signal(0);
const initialized = signal(false);

effect(() => {
	count.value;
	if (!initialized.peek()) return initialized.value = true;
	console.log(count.value)
});

count.value++;

The effect here will not subscribe to count, even though it's explicitly accessed. Swapping that to count.value.toString() works, however.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant