hoodiehq / hoodie-client

:dog: Client API for the Hoodie server
Apache License 2.0
34 stars 25 forks source link

Hoodie constructor does not pass through options properly #89

Closed espy closed 8 years ago

espy commented 8 years ago

The docs say we can pass in options to the Hoodie constructor:

  var hoodie = new Hoodie(options)

and that these look something like this:

  var options = {
    account: {
      id: '9h57fpa'
    }
  }

However, taking a look at https://github.com/hoodiehq/hoodie-client/blob/master/lib/get-state.js#L9-L16, all of these sub options described in the docs are ignored completely.

Our use case was that we wanted to open an existing user's DB in Service Worker. We did

  const store = new Hoodie({
    account: {
      id: '9h57fpa'
    }
  })

but Hoodie ignores the options and creates a new user DB with a random ID instead.