Remove Derivation.changesWithoutValues()

And replace it with `Derivation.onStale()`
This commit is contained in:
Aria Minaei 2022-12-01 13:31:16 +01:00
parent 9094e3041e
commit 5c1aa1cd50
13 changed files with 19 additions and 916 deletions

View file

@ -49,7 +49,7 @@ export default class AudioPlaybackController implements IPlaybackController {
// We're keeping the rangeD hot, so we can read from it on every tick without
// causing unnecessary recalculations
const untapFromRangeD = rangeD.changesWithoutValues().tap(play)
const untapFromRangeD = rangeD.onStale(play)
play()
this._stopPlayCallback = () => {

View file

@ -283,9 +283,9 @@ export default class SheetObject implements IdentityDerivationProvider {
interpolate(left, right, triple.progression),
)
}
const untap = derivation
.changesWithoutValues()
.tap(updateSequenceValueFromItsDerivation)
const untap = derivation.onStale(
updateSequenceValueFromItsDerivation,
)
updateSequenceValueFromItsDerivation()
untaps.push(untap)

View file

@ -15,7 +15,7 @@ export default class PaneManager {
private _instantiatePanesAsTheyComeIn() {
const allPanesD = this._getAllPanes()
allPanesD.changesWithoutValues().tap(() => {
allPanesD.onStale(() => {
allPanesD.getValue()
})
}

View file

@ -180,7 +180,7 @@ export class Studio {
}
}
}
projectsD.changesWithoutValues().tap(() => {
projectsD.onStale(() => {
attachToProjects(projectsD.getValue())
})
attachToProjects(projectsD.getValue())

View file

@ -311,7 +311,7 @@ function useUpdateScrollFromClippedSpaceRange(
const rangeStartInScaledSpace = d.getValue()
node.scrollLeft = rangeStartInScaledSpace
}
const untap = d.changesWithoutValues().tap(update)
const untap = d.onStale(update)
update()
const timeout = setTimeout(update, 100)

View file

@ -29,7 +29,7 @@ export const useTooltipOpenState = (): [
}, [])
useEffect(() => {
return cur.changesWithoutValues().tap(() => {
return cur.onStale(() => {
const flag = cur.getValue() === id
if (isOpenRef.current !== flag) isOpenRef.current = flag