Skip to content

Commit

Permalink
Created workaround for FF Jit bug, should fix #614
Browse files Browse the repository at this point in the history
  • Loading branch information
mweststrate committed Sep 19, 2017
1 parent 53afbef commit eb74564
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/core/derivation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,29 +153,30 @@ function bindDependencies(derivation: IDerivation) {
const observing = (derivation.observing = derivation.newObserving!)
let lowestNewObservingDerivationState = IDerivationState.UP_TO_DATE

derivation.newObserving = null // newObserving shouldn't be needed outside tracking

// Go through all new observables and check diffValue: (this list can contain duplicates):
// 0: first occurrence, change to 1 and keep it
// 1: extra occurrence, drop it
let i0 = 0,
l = derivation.unboundDepsCount
l = derivation.unboundDepsCount
for (let i = 0; i < l; i++) {
const dep = observing[i]
const dep = observing[i]
if (dep.diffValue === 0) {
dep.diffValue = 1
dep.diffValue = 1
if (i0 !== i) observing[i0] = dep
i0++
i0++
}

// Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined,
// not hitting the condition
if (((dep as any) as IDerivation).dependenciesState > lowestNewObservingDerivationState) {
lowestNewObservingDerivationState = ((dep as any) as IDerivation).dependenciesState
lowestNewObservingDerivationState = ((dep as any) as IDerivation).dependenciesState
}
}
observing.length = i0

derivation.newObserving = null // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614)

// Go through all old observables and check diffValue: (it is unique after last bindDependencies)
// 0: it's not in new observables, unobserve it
// 1: it keeps being observed, don't want to notify it. change to 0
Expand Down

0 comments on commit eb74564

Please sign in to comment.