mickhansen/dataloader-sequelize

getCacheKey does not handle where clauses with Symbols

tomlagier opened this issue · 1 comments

Per Sequelize v4 docs, the correct way to include where clause operators is to import them from sequelize.Op, like so:

const { Op: {iLike} } = require('sequelize');
...
where: {
   name: { [iLike]: `%${args.query}%` },
},

These are implemented as Symbols within sequelize. Unfortunately, Object.keys does not return symbols when iterating over an object's properties to construct a cache key through stringifyObject.

The fix here is to merge Object.keys with Object.getOwnPropertySymbols in stringifyObject. I'll make a PR for it but anyone running into this can work around it by reverting to the sequelize v3 string-style $operator ($iLike) instead of using the imported operator.

Thanks for maintaining this library @mickhansen! Enjoying it and graphql-sequelize as my first entry into graphql very much.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.