apollographql / meteor-integration

🚀 meteor add apollo
http://dev.apollodata.com/core/meteor.html
108 stars 45 forks source link

Add eslin+prettier & use rawCollection for the user lookup #82

Closed xavxyz closed 7 years ago

xavxyz commented 7 years ago

This PR is about quality control & provide a consistent package (I hope!) along its future releases.

It sets up ESLint & prettier. So far so good, the package is still running & usable in a Meteor app but... it broke the tests with the dreaded Error: Can't wait without a fiber 😵 (screenshot).

➡️ Using directly the npm mongo driver with Meteors.users.rawCollection() solved this testing problem (and a Meteor app running with the package still receive data from the server):

const currentUser = await Meteor.users.rawCollection().findOne({
  'services.resume.loginTokens.hashedToken': hashedToken,
});

Fibers-aware queries sent to the server are handled thanks to https://github.com/apollographql/graphql-server/pull/92

Thus I believe there is also no need for Meteor.bindEnvironment as we are not running anymore Fibers-aware code on the GraphQL server creation? 🤔 cc/ @stubailo @helfer