Dynamic observable cannot be frozen.
See original GitHub issueThis issue also refers to this one #1881 I am having the following issue and it can be recreated as follows:
The allVehicles variable is an array of string IDs;
@observable allVehicles;
@action setAllVehicles(vehiclesID) {
this.allVehicles = vehiclesID;
}
}
Then here the VehiclesStore.setSelectedObject sets the selectVehicle to an observable variable inside the VehiclesStore, based on the vehicleID i find witch vechicle from VehiclesStore.objects i need to have selected. The VehiclesStore.objects is also an observable array of objects
selectVehicle(vehicleID) {
let selectVehicle = VehiclesStore.objects.find(vehicle => vehicle.id === vehicleID);
VehiclesStore.setSelectedObject(selectVehicle);
}
Based on the allVehicles observable i’m creating a list of PickerItems like so,
The value of one entry of the allVehicles array looks like this:
<Picker.Item key = {'myID'} value = {'vehicleID'} label = {'Plate'}/>
<Picker
style = {{ width: '100%' }}
mode = { "dropdown" }
prompt = {"Select a vehicle"}
onValueChange = {(vehicleID) => {
console.log(vehicleID); **THIS IS NEVER REACHED**
this.selectVehicle(vehicleID);
this.props.props.navigate('Details', {props: this.props});
}}
>
{VehiclesStore.allVehicles}
</Picker>
I hope that this information it’s helpful.
Issue Analytics
- State:
- Created 5 years ago
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Frozen Data - mobx-keystone
frozen basically wraps a plain chunk of data (composed of plain objects, arrays, primitives, or a mix of them) inside a model-like structure,...
Read more >mobxjs/mobx - Gitter
hi, just upgraded my app to mobx5, and many things break with this error: [mobx] Dynamic observable objects cannot be frozen
Read more >MobX observable with dynamic data - Stack Overflow
I am new to MobX, and read that I need to make use of map() but I am unable to find a decent...
Read more >[mobx] Dynamic observable objects cannot be frozen 解决记录
[mobx] Dynamic observable objects cannot be frozen 解决记录.
Read more >mobx] Dynamic observable objects cannot be frozen
Dynamic observable objects cannot be frozen · Javascript Required. Kindly enable Javascript. · [mobx] Dynamic observable objects cannot be frozen].
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
At first glance it sounds like you are pasisng observable data to Picker where you shouldn’t, since it doesn’t understand them. Try to
toJS
your value firstOp ma 11 feb. 2019 om 09:58 schreef itamar sharify <notifications@github.com
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.