Skip to content

Non observable object #322

Answered by xaviergonz
maccman asked this question in Q&A
Sep 20, 2021 · 2 comments · 6 replies
Discussion options

You must be logged in to vote

do you need to to be serializable? if not then maybe put it outside the model props

@model('Note')
export class Note extends Model({
  subject: prop<string>(() => ''),
}) {
  document?: ProsemirrorJson;

  // or if you want it to be shallowly observable
  @observable.shallow
  document?: ProsemirrorJson;
}

alternatively, if you need it to be a model prop and the object is immutable you might use 'frozen'
https://mobx-keystone.js.org/frozen

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@xaviergonz
Comment options

@vojto
Comment options

@xaviergonz
Comment options

@xaviergonz
Comment options

@vojto
Comment options

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