Skip to content

Signals force update #30

@cesarParra

Description

@cesarParra

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
});

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions