-
I have a store where I load in a list of authors, which is the type The The Now I want to add another field, But the code I've tried to implement, does not resolve the IDs of the What am I doing wrong? // Props that both `BulletinBoardPost` and `BulletinBoardPostComment` share
export const BulletinBoardPostSharedProps = {
postId: types.identifier,
author: types.safeReference(EgInteressent), // this resolves to {"egInteressentNummer": "434343", "name": "Bobby Olsen"}
body: types.string,
likedBy: types.array(types.safeReference(EgInteressent)), // This remains like ["454545", "434343"]
files: types.maybe(types.array(File)),
createDate: types.string,
} export const EgInteressent = types.model('EgInteressent').props({
egInteressentNummer: types.identifier,
name: types.string,
}) export const BulletinBoard = types.model('BulletinBoard').props({
boardId: types.identifier,
name: types.string,
authors: types.optional(types.map(EgInteressent), {}),
posts: types.optional(types.array(BulletinBoardPost), []),
isExhausted: types.optional(types.boolean, false),
isLoading: types.optional(types.boolean, false),
}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I made it work. So apparently, I cannot console.log the values of a property of the store, I have to iterate through the array before I get the resolved values. https://codesandbox.io/s/mobx-state-tree-todolist-forked-u53bu |
Beta Was this translation helpful? Give feedback.
I made it work. So apparently, I cannot console.log the values of a property of the store, I have to iterate through the array before I get the resolved values.
https://codesandbox.io/s/mobx-state-tree-todolist-forked-u53bu