Skip to content

Multiple @accounts/client versions: consider using peerDependencies #33

@diegonc

Description

@diegonc

If you follow the installation procedure stated in the README, there will be multiple versions of @accounts/client installed resulting in the following error when loading the page:

Uncaught (in promise) Error: no tokens provided
    at AccountsError.ExtendableBuiltin (http://192.168.56.101:3000/bundle.js:78029:29)
    at new AccountsError (http://192.168.56.101:3000/bundle.js:78059:117)
    at AccountsClient._callee7$ (http://192.168.56.101:3000/bundle.js:60416:24)
    at tryCatch (http://192.168.56.101:3000/bundle.js:17026:41)
    at Generator.invoke [as _invoke] (http://192.168.56.101:3000/bundle.js:17261:23)
    at Generator.prototype.(anonymous function) [as next] (http://192.168.56.101:3000/bundle.js:17078:22)
    at step (http://192.168.56.101:3000/bundle.js:60100:192)
    at http://192.168.56.101:3000/bundle.js:60100:362

You can reproduce it by starting a project from scratch, which as of today, leads to the following packages being installed:

yarn list v0.21.3
├─ @accounts/[email protected]
│  ├─ @accounts/common@^0.0.7
│  ├─ @accounts/[email protected]
│  │  └─ lodash@^4.16.4
│  ├─ immutable@^3.8.1
│  ├─ jwt-decode@^2.1.0
│  ├─ lodash@^4.16.4
│  ├─ redux-immutable@^3.0.8
│  └─ redux@^3.6.0
├─ @accounts/[email protected]
│  ├─ apollo-errors@^1.2.1
│  └─ lodash@^4.16.4
├─ @accounts/[email protected]
│  ├─ @accounts/[email protected]
│  ├─ @accounts/[email protected]

Also, in js-accounts/examples you can remove client package from package.json and do

yarn add @accounts/client

now when you run the example the cited exception should appear.

This error is produced by the fact that multiple versions of @accounts/client introduce different instances of the AccountClient class being used by the several modules that require it.

By switching to using peer dependencies the user of react and react-material-ui can upgrade other components of js-accounts independently as long as versions are compatible.

Does this make sense?


EDIT: I revisited this issue (because of trying out graphql support) and realised that it was not commons the culprit but @accounts/client.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions