Intended outcome:
Don't throw error on passing same options twice.
Actual outcome:
options. notifyOnNetworkStatusChange is set to be false at first time, and will throw error at then second time.
How to reproduce the issue:
Check these codes, should we only check options.notifyOnNetworkStatusChange is true?
Version
For now, I can only new an options object every time temporarily.
The point of that line is to make sure that the application developer doesn't pass a notifyOnNetworkStatusChange option to query. This is because query doesn't support this option because it doesn't watch the query for changes its result, as opposed to watchQuery which does watch the result.
In what situation do you have to pass a false for notifyOnNetworkStatusChange when calling query and then need to use that instance to change the option?
@Poincare I'm not passing notifyOnNetworkStatusChange: false, it is set internally.
I think we should only check whether options.notifyOnNetworkStatusChange is truthy.
I think the !== undefined check is fine, I would prefer either doing an Object.assign as to not mutate the query options or remove the above mentioned line. I think removing the line is fine as the watchQuery does the same mutation.
That should probably be fixed as well.
This should no longer be an issue with current versions of apollo-client. Thanks!
Most helpful comment
@Poincare I'm not passing
notifyOnNetworkStatusChange: false, it is set internally.https://github.com/apollographql/apollo-client/blob/02770cafc8f541064a69c2f30049044e27036c4b/packages/apollo-client/src/core/QueryManager.ts#L663
I think we should only check whether
options.notifyOnNetworkStatusChangeistruthy.