Closed rlindner81 closed 5 months ago
⚠️ The changeHandler and scope concepts are tricky to mix. Because the newValue
that the changeHandler gets is only relative to the scopeMap that was last touched. And sometimes multiple values change at once with the clearSubScopes
option.
The easiest fix is making sure that the changeHandler is only called after the change happened internally and then the code in the changeHandler can do a get with the relevant runtime scopes that they care about...
Still, for superficial use-cases with no scopes involved, it would be nice if the changeHandler callback API gives you the newValue directly.
The change handlers don't hold state and can't resolve null to the fallback value, so they should always get the actual value...
There is also a subtlety here, where using null for a scoped value can cause the new value to not be the fallback value, because another, broader scoped value could still apply.