lvarayut/relay-fullstack

id should be strings not int ?

apage224 opened this issue · 2 comments

I believe I found an issue with the way IDs are being used in the example. database.js uses int type for IDs rather than string type. In schema.js the queryType uses getUser(1) using 1 for the resolver of viewer. However, in nodeDefinitions the first method uses fromGlobalId which I believe returns an id as a string. Thus when type is 'User' the getUser(id) will have an id of '1' which causes the function to incorrectly return null. Simple fix would be to use abstract equality (==) vs strict equality (===) in getUser() and getFeature() OR use string IDs.

I noticed this when I had a need to perform a force query (w/ forcefetch={true} on viewer and got back null.

On a side note, I notice your still using react-mdl which is deprecated. I would highly recommend material-ui.

Thanks for spotting that! Yeah, at some point I changed IDs to int, but must have missed that instance. Will address this (or you can PR).
Concerning react-mdl, a PR is also welcome :)

@apage2, the issue's fixed in #93. Regarding the react-mdl, we plan to remove it entirely and use just a vanilla css 😄