kh90909 / OakTerm

Serial terminal for the Digistump Oak over the Particle Cloud
8 stars 2 forks source link

Don't set default device, add current_device localstorage #33

Closed emcniece closed 8 years ago

emcniece commented 8 years ago

There is a problem right now with login, device init, and subscriber setup. Current process looks like this:

  1. Particle auth login
    1. Populate device list select box
  2. Start pollers (uses current_device, set by device list population)
  3. Update devices, get info, get variables
  4. Subscribe to events for selected device, dump to terminal

On login, this process dumps a device list to the select box, then immediately subscribes to the first device in the list. This subscribe action can be unnecessary if the device is inactive, and it can be counter-productive if a frequent user constantly refreshes the page and finds that the list has reset.

current_device could be stored in localStorage, and it can be auto-set on init. The select box should default to a "-- Select Device --" option, and this will address https://github.com/kh90909/OakTerm/issues/10

emcniece commented 8 years ago

There is also a scenario where a user can change the select device dropdown post-page-load but pre-subscription event, and this throws the app into a weird state. Defaults will prevent this.

emcniece commented 8 years ago

Complete with https://github.com/kh90909/OakTerm/pull/35