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 two models: CheckoutModel and ItemModel. I want to be able to create a local CheckoutModel to add ItemModels to before saving. However on my first try, after adding an item to my checkout.items and executing a view on the checkout to calculate the total cost, this error was produced:
Failed to resolve reference 63d6f382a0afdb03a9a1b53d to late(() => ItemModel)
It appears that locally created models are detached from the RootStore which is causing the error (which makes total sense.) The workaround is to manually set the store on the new instance:
This is weird, and makes me feel like I shouldn't be doing this at all. I suppose I should just be creating a new model to only be used for local state, but I don't want to wind up having to do this for every applicable model in my application. For now I'll be abstracting this behind some useLocalInstance hook, or within an afterCreate in my models.
Any thoughts are definitely appreciated!
The text was updated successfully, but these errors were encountered:
I have two models:
CheckoutModel
andItemModel
. I want to be able to create a localCheckoutModel
to addItemModel
s to before saving. However on my first try, after adding an item to mycheckout.items
and executing a view on thecheckout
to calculate the total cost, this error was produced:Failed to resolve reference 63d6f382a0afdb03a9a1b53d to late(() => ItemModel)
It appears that locally created models are detached from the
RootStore
which is causing the error (which makes total sense.) The workaround is to manually set the store on the new instance:This is weird, and makes me feel like I shouldn't be doing this at all. I suppose I should just be creating a new model to only be used for local state, but I don't want to wind up having to do this for every applicable model in my application. For now I'll be abstracting this behind some
useLocalInstance
hook, or within anafterCreate
in my models.Any thoughts are definitely appreciated!
The text was updated successfully, but these errors were encountered: