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

Signals force update #30

Open
cesarParra opened this issue Dec 7, 2024 · 0 comments
Open

Signals force update #30

cesarParra opened this issue Dec 7, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@cesarParra
Copy link
Owner

Currently, signals only evaluate their dependents if a change is detected in the signal value. Something is considered a change if the value is different or, in the case of an object, if the isEqual function deems it different.

There are cases when we want for dependents to reevaluate no matter what, any time that the signal's setter is called. This can be to override the isEqual check, or simply because we want to force trigger a dependent (for example, to rerun an effect, or to update a stale resource by forcing it to go to the DB).

Proposal

Add a force flag to the signal on creation. When on then the signal's setter will bypass the equality check and always notify its dependents that something changed.

$signal(0, {
  force: true
});
@cesarParra cesarParra added enhancement New feature or request good first issue Good for newcomers labels Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants