Post React Studio update - selector throwing an error (Solved)


#1

Hey guys,

After the latest React Studio upgrade, I’m getting the following error when I build for the browser:

I have a selector inside a drawer, if that’s helpful… it looks like this:

If I delete the selector, it’s fine, but obviously I would like to keep it around. :slight_smile: I’m happy to provide the code glance for the component if it’s helpful.

Thanks!


#2

Actually we never thought the selector be used in drawer but the UI does not prevent it either…

The issue comes up probably because there were fixes made to selectors ”selected index” data linkage. Just for quick fix: What if you set dummy data slot for selected index?


#3

Hey Antti,

I tried that just now, and while the site compiles, the selector isn’t able to change state. But… I think I found the issue. When I change the code manually from this (in the render function):

let contentElement_elSetupVsSimulator;
switch (selectedIndex_selector) {
  default:
  case 0:
    contentElement_elSetupVsSimulator = (<DeviceInstructions appActions={this.props.appActions} deviceInfo={this.props.deviceInfo} locStrings={this.props.locStrings} />);
  break;
  case 1:
    contentElement_elSetupVsSimulator = (<IPhoneSim appActions={this.props.appActions} deviceInfo={this.props.deviceInfo} locStrings={this.props.locStrings} />);
  break;
  case 2:
    contentElement_elSetupVsSimulator = (<SetupInstructions appActions={this.props.appActions} deviceInfo={this.props.deviceInfo} locStrings={this.props.locStrings} />);
  break;
}

to this:

let contentElement_elSetupVsSimulator;
switch (this.state.selectedIndex_selector) {
  default:
  case 0:
    contentElement_elSetupVsSimulator = (<DeviceInstructions appActions={this.props.appActions} deviceInfo={this.props.deviceInfo} locStrings={this.props.locStrings} />);
  break;
  case 1:
    contentElement_elSetupVsSimulator = (<IPhoneSim appActions={this.props.appActions} deviceInfo={this.props.deviceInfo} locStrings={this.props.locStrings} />);
  break;
  case 2:
    contentElement_elSetupVsSimulator = (<SetupInstructions appActions={this.props.appActions} deviceInfo={this.props.deviceInfo} locStrings={this.props.locStrings} />);
  break;
}

…then it compiles and runs just fine. :-). The only (minor) issue is that I’ll need to remember to manually make this change before I publish.

Thanks!


#4

Thanks for the update, team Neonto! Everything is working great now. :slight_smile: