-
-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix problem with stringifying date objects #485
Conversation
This is awesome work, thanks for tackling this! The issue you are encountering can probably be solved by aliasing React and react-dom to your local version in webpack like
This is because you are symlinking from another folder with it's own node_modules/react |
src/utils/stringifyVariables.ts
Outdated
@@ -1,6 +1,7 @@ | |||
const seen = new Set(); | |||
|
|||
const stringify = (x: any): string => { | |||
if (x && x.toJson) x = x.toJSON(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like this isn’t quite the right check. We could also move it down to avoid the double null check and do a proper typeof
being “function” check?
I’m also wondering, what are we really accomplishing for moment here? Don’t we want to convert it and dates to a UTC string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I recall correctly the normal way for serializing a complex object is through the .toJSON
function which is present on most libraries like moment
, day-js
,...
Not sure if this test is enough or if we should import sth like moment to test it with their dates as well |
For some reason when I tried to include the library locally I got an error about Invalid hook calls:
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
So I was not able to test if it fixes those for sure
This possibly:
fixes #479 and fixes #478