canjs / can-view-scope

Scope management for view engines
https://canjs.com/doc/can-view-scope.html
MIT License
4 stars 0 forks source link

fast-path scope-key-data can have the wrong value #88

Closed justinbmeyer closed 6 years ago

justinbmeyer commented 7 years ago

If a fast-path-able observable, when initially bound, immediately fires events, this will cause the internal observation to be added to the update queue.

However, fast-path will be detected. When .start() is called by the updateQueue, there won't be a new value.

One (not possible) solution would to somehow track events by those objects ... so that we could use those events to update the ScopeDataKey accordingly.

Another solution is to somehow check if the observation is queued (needsUpdate=true ... and then to not fast-path because the binding seemed to cause events to be fired).

Another solution would be cache this.value as this.newVal.

justinbmeyer commented 7 years ago

for can-kefir, I'm working around this problem by only throwing events on a change

justinbmeyer commented 7 years ago

if an observation is bound, but has a dependency change, something is wrong.

Example:

    new Observation(function(){
        return todoConnection.store.itemsCount + todo.age
    })
justinbmeyer commented 6 years ago

I bet this is solved by can-queues