Skip to content

How does MST BaseNode inheritance work? #2126

Discussion options

You must be logged in to vote

I think I got it, it's because of the .value in return this.instantiate(null, "", environment, snapshot!).value in BaseType's create method, which passes back storedValue, which is the actual observable, and not the instance of the thing itself. I walked through the debugger on my examples and I think I see it now.

I put a breakpoint on const rootStore = RootStore.create({ subStore: { title: "hello" } }) and wrote some notes. These aren't particularly well-polished, and they're definitely missing some of the fine-grained details, but it helped a lot:

  1. We start off in the create method on the ComplexType class, and use the snapshot, which is what we passed in to create.
  2. That actually calls s…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@coolsoftwaretyler
Comment options

Answer selected by coolsoftwaretyler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant