-
Notifications
You must be signed in to change notification settings - Fork 641
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
types.map shows error when using types.number in identifier subtype #191
Comments
Hi! Thanks for reporting! |
Yes! It fix now But I found another bug when I put the same identifier on map. const Todo = types.model("Todo", {
todo_id: types.identifier(types.number),
title: types.string,
})
const TodoStore = types.model("TodoStore", {
todos: types.optional(types.map(Todo), {}),
}, {
addTodo(todo) {
this.todos.put(todo)
},
})
const todoStore = TodoStore.create({})
todoStore.addTodo({
todo_id: 1,
title: "Test",
})
console.log(todoStore.todos.toJSON())
// PRINT: { '1': { todo_id: 1, title: 'Test' } }
todoStore.addTodo({
todo_id: 1,
title: "Test Edited",
})
console.log(todoStore.todos.toJSON())
// PRINT: { '': { todo_id: 1, title: 'Test Edited' } } <-- it shows the key is empty string
console.log(todoStore.todos.get(1).toJSON())
// PRINT: { todo_id: 1, title: 'Test Edited' } <-- but it can get the model that i put |
Thanks for reporting again! :) |
Yes! It's fixed now |
You're welcome! Will be released soon! |
It shows
But when I use types.string as identifier, it's ok
The text was updated successfully, but these errors were encountered: