Skip to content

Invalidation of atom (...) in watched scope (...) is dangerous. #14

Answered by vanifatovvlad
Girildo asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

the message Invalidation of atom (X) in watched scope (Y) is dangerous means that you are changing the value of an X atom during the evaluation of another Y atom (computed or reaction). The simplest case is:

[Atom] public int X { get; set; }

Atom.Reaction(() => X = 123, debugName: "Y");

Detailed

There are three types of atoms in the library: Value, Computed and Reaction:

  • Value atoms must changed as a result of user actions;
  • Computed atoms must be evaluated based on other computed atoms and value atoms;
  • Reactions are designed to trigger side effects, such as updating the user interface.

However sometimes due to programmer mistake it turns out that the value of atoms is changed direc…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Girildo
Comment options

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