You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an interesting setup here. Basically I need to store a reference to a selected property, which is a composed model of a base Property model type with an extended set of properties on it. But when I try to se the selectedProperty on my store to this composed model I get the error saying it can't convert the model I tried to set it to, to what the store says the reference type is supposed to be. I will try to show the code that is relevant here
Store has a property on it to store the selectedProperty
When I later try to call an action on the store to set the selectedProperty to this BaseLayerProperty it gives me the type conversion error
mobx-state-tree.module.js:3828 Uncaught Error: [mobx-state-tree] Error while converting <BaseLayerProperty@/layers/0/properties/0(id: 156f1888-6cd3-41c8-9052-79290b176c16)> to `(reference(Property) | null)`:
value of type BaseLayerProperty: <BaseLayerProperty@/layers/0/properties/0(id: 156f1888-6cd3-41c8-9052-79290b176c16)> is not assignable to type: `(reference(Property) | null)`, expected an instance of `(reference(Property) | null)` or a snapshot like `(reference(Property) | null?)` instead.
I can store this selectedProperty on my context provider but I would love to get this all inside the mobx store if possible just so it's all in one place
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have an interesting setup here. Basically I need to store a reference to a selected property, which is a composed model of a base
Property
model type with an extended set of properties on it. But when I try to se theselectedProperty
on my store to this composed model I get the error saying it can't convert the model I tried to set it to, to what the store says the reference type is supposed to be. I will try to show the code that is relevant hereStore has a property on it to store the
selectedProperty
The
Property
reference looks like thisThen later I compose this
Property
into a new type with an extra model propertyWhen I later try to call an action on the store to set the
selectedProperty
to thisBaseLayerProperty
it gives me the type conversion errorI can store this
selectedProperty
on my context provider but I would love to get this all inside the mobx store if possible just so it's all in one placeBeta Was this translation helpful? Give feedback.
All reactions