question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dynamic observable cannot be frozen.

See original GitHub issue

This 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:closed
  • Created 5 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mweststratecommented, Feb 11, 2019

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 first

Op ma 11 feb. 2019 om 09:58 schreef itamar sharify <notifications@github.com

:

here is a working react-native codesandbox: https://codesandbox.io/s/zlkv3rpqqm can you try to reproduce it here?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/mobxjs/mobx/issues/1900#issuecomment-462255404, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvGhNq2P7hTBo46bKpBeMnio3GamfjOks5vMTCggaJpZM4azq6v .

0reactions
lock[bot]commented, Jul 21, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found