menu

mobx-state-tree

Opinionated, transactional, MobX powered state container combining the best features of the immutable and mutable world for an optimal DX

Channels
Team
Posts
Members
Info

How to pass dependency injections down to every child nodes ?

My store is composed of different models that are in a tree shape like this : All the types are optional so i can create the store like this : How could I access the env variables on the deepest nodes in the tree ?

thumbsup
0
message-simple
9

How can I display a comment after creating it?

I want to be able to create a comment and then display it with the rest of the comments without having to refresh the page. The problem is that whenever I create a comment, all of the properties are undefined (except for the body property which I am sending from the form) which…

thumbsup
0
message-simple
1

Recursive async action

I have a service that executes a task that takes some time. The service has a REST endpoint that I can hit to get the progress status of the task. I've modeled the status as a value in my MST store. I want to kick off an action that will hit this REST endpoint every few seconds…

thumbsup
0
message-simple
1

TypeScript typing for async actions - yield*

This is a topic that has been raised many times (here are a couple: https://github.com/mobxjs/mobx-state-tree/issues/1378, https://github.com/mobxjs/mobx-state-tree/issues/1516), and it's something that's always an immediate momentum-breaker when introducing anyone to MST. I…

thumbsup
1
message-simple
19

What happens when state is updated while still calculating values?

Imagine I have a long dependency chain of calculated values. What will mobx-state-tree do if, while still calculating the views/calculated values, some of the dependencies (state) of that chain changes? Will it continue to solve the original equations, and then re-calculate with…

thumbsup
0
message-simple
3

types.compose error

I'm trying to compose two stores, When I do that I get the following error TypeError: child.finalizeCreation is not a function What's wrong? …

thumbsup
1
message-simple
3

How to handle several sources of truth?

Hey all. What would be the best setup provided I have several sources of truth (GraphQL endpoints) that need to be queried. Im using MST and would like to add mst-gql. Also the GraphQL entity models can have the same name across those endpoints

thumbsup
0
message-simple
1

How to set data for observer array?

i have an array like: dataTags: types.optional(types.array(DataFilter), []) export const DataFilter = types.model({ …

thumbsup
0
message-simple
0

Derived values and Views

Derived values in Mobx I'm pretty familiar with the concept of Derivations in Mobx, Particularly the idea that derivations come in two different forms. …

thumbsup
0
message-simple
3

Potential race condition?

Does anyone have any insight into whether it might be possible to end up with a race condition between a property that uses types.optional and values being set on that same property in afterAttach? Seeing some odd behavior, but I cannot replicate the problem myself. Seems to be…

thumbsup
0
message-simple
1