Unify Derivation and Prism 2/n

This commit is contained in:
Aria Minaei 2022-12-01 14:22:49 +01:00
parent 12b3f477bc
commit bfba1d4879
8 changed files with 17 additions and 17 deletions

View file

@ -10,7 +10,7 @@ import userReadableTypeOfValue from '@theatre/shared/utils/userReadableTypeOfVal
import deepEqual from 'fast-deep-equal'
import type {PointerType} from '@theatre/dataverse'
import {isPointer} from '@theatre/dataverse'
import {isDerivation, valueDerivation} from '@theatre/dataverse'
import {isPrism, valueDerivation} from '@theatre/dataverse'
import type {$IntentionalAny, VoidFn} from '@theatre/shared/utils/types'
import type {ProjectId} from '@theatre/shared/utils/ids'
import {_coreLogger} from './_coreLogger'
@ -161,7 +161,7 @@ export function onChange<P extends PointerType<$IntentionalAny>>(
callback as $IntentionalAny,
true,
)
} else if (isDerivation(pointer)) {
} else if (isPrism(pointer)) {
return pointer.onChange(getCoreTicker(), callback as $IntentionalAny, true)
} else {
throw new Error(

View file

@ -1,4 +1,4 @@
import {isDerivation, prism, val} from '@theatre/dataverse'
import {isPrism, prism, val} from '@theatre/dataverse'
import type {Prism, Pointer} from '@theatre/dataverse'
import {useDerivation} from '@theatre/react'
import type {$IntentionalAny} from '@theatre/shared/utils/types'
@ -70,7 +70,7 @@ export function deriver<Props extends {}>(
}
for (const key in props) {
const value = props[key]
if (isDerivation(value)) {
if (isPrism(value)) {
observableArr.push(value)
observables[key] = value
} else {