Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

frozen and applySnapshot [bug] #634

Closed
maxguzenski opened this issue Jan 31, 2018 · 5 comments
Closed

frozen and applySnapshot [bug] #634

maxguzenski opened this issue Jan 31, 2018 · 5 comments
Labels
bug Confirmed bug help/PR welcome Help/Pull request from contributors to fix the issue is welcome

Comments

@maxguzenski
Copy link

maxguzenski commented Jan 31, 2018

When use applySnapshot it set a optional t.frozen to undefined...
Is this expected ?

const Model = types.model('model', {
  field: t.optional(t.frozen, {})
})

const m = Model.create({})
m.field == {} 

applySnapshot(m, {})
m.field == undefined
@elite174
Copy link

elite174 commented Feb 7, 2018

Try this.
https://jsfiddle.net/43a9bepv/

@maxguzenski maxguzenski changed the title frozen and applySnapshot frozen and applySnapshot [bug] Feb 7, 2018
@aretecode
Copy link
Contributor

this is the same issue I saw here #347

@robinfehr robinfehr mentioned this issue Mar 21, 2018
@robinfehr robinfehr added bug Confirmed bug help/PR welcome Help/Pull request from contributors to fix the issue is welcome labels Mar 21, 2018
@robinfehr
Copy link
Contributor

PR welcome. it's now on the todo list.

mweststrate added a commit that referenced this issue Jun 8, 2018
…ozen-to-default-value

#634 fix optional frozen to return default value if undefined
@mweststrate
Copy link
Member

Fix released as 2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bug help/PR welcome Help/Pull request from contributors to fix the issue is welcome
Projects
None yet
Development

No branches or pull requests

5 participants