Closed kevinmasd closed 8 years ago
setState has some kind of delay that causes issues with json correctness.
Default set back to false, given I can't guarantee robot can be sent a json file on connect.
@kevinmasd The problem is that the program will reach the Ansible.sendMessage
line before this.setState
has had time to take effect. You need to do the message sending part in a function passed to this.setState
. For example:
this.setState({gameEnable: !this.state.gameEnable}, ()=>{
Ansible.sendMessage('game', {
enabled: this.state.gameEnable,
autonomous: this.state.gameAuto
});
});
In general, you can do:
this.setState(data, function);
Done.
Is there a persistent variable I can store this data, or would I have to create an indicator file?
Ah, I recommend just removing this change for now so I can just merge this in, since #211 is not a priority right now. Then you can make the necessary changes in a different PR.
You would use the electron-json-storage
to store this data permanently, which you can import like so: https://github.com/pioneers/daemon/blob/develop/dawn/js/components/Editor.js#L32.
You can see the actual documentation here: https://github.com/jviotti/electron-json-storage
Tour now is based on first run. I'm not going to rebase given that the last time I tried to do so, I had more commits than when I began.
Buttons are currently next to the change theme dropdown. May need to change icons to something more intuitive.