[feature/Apollo] Error on page refresh: Cannot match against 'undefined' or 'null'.
See original GitHub issueOn the [feature/apollo] branch, I have a very basic component that receives data from a GraphQL query. When I go to this page, the query returns all of the data I would expect.
import React from 'react';
import PropTypes from 'prop-types';
import { graphql } from 'react-apollo';
import getChannelsandUsersQuery from './getChannelsandUsersQuery.graphql';
class SendMessageForm extends React.Component {
render() {
return (
<div>
Test
</div>
);
}
}
export default graphql(getChannelsandUsersQuery)(SendMessageForm);
If I refresh the page, the app throws a big error:
Error: GraphQL error: Cannot match against 'undefined' or 'null'.
at new ApolloError (C:\Users\asdf\Desktop\asdf\node_modules\apollo-client\src\errors\ApolloError.js:32:28)
at C:\Users\asdf\Desktop\asdf\node_modules\apollo-client\src\core\QueryManager.js:281:41
at C:\Users\asdf\Desktop\asdf\node_modules\apollo-client\src\core\QueryManager.js:726:25
at Array.forEach (native)
at C:\Users\asdf\Desktop\asdf\node_modules\apollo-client\src\core\QueryManager.js:723:27
at Array.forEach (native)
at QueryManager.broadcastQueries (C:\Users\asdf\Desktop\asdf\node_modules\apollo-client\src\core\QueryManager.js:720:42)
at QueryManager.broadcastNewStore (C:\Users\asdf\Desktop\asdf\node_modules\apollo-client\src\core\QueryManager.js:71:14)
at C:\Users\asdf\Desktop\asdf\node_modules\apollo-client\src\ApolloClient.js:45:44
at C:\Users\asdf\Desktop\asdf\node_modules\redux-thunk\lib\index.js:14:16
at Object.dispatch (C:\Users\asdf\Desktop\asdf\node_modules\redux\lib\applyMiddleware.js:45:18)
at C:\Users\asdf\Desktop\asdf\node_modules\apollo-client\src\core\QueryManager.js:657:33
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:208:7)
I am still on the new side to react/graphql and this is a real head scratcher, can someone point me in the right direction so that refreshes do not break the app?
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
TypeError: Cannot match against 'undefined' or 'null'
this error should only arise if the array or object being destructured or its children is undefined or null . Exactly. In your...
Read more >Uncaught TypeError: Cannot match against 'undefined' or 'null'.
i try run atom on safe mode,same error: Failed to load the tool-bar package. Cannot match against 'undefined' or 'null'. Hide Stack Trace...
Read more >Auth0 client is null in React Component on page refresh
The error is Unhandled Rejection (TypeError): Cannot read property 'getTokenSilently' of undefined Works fine after the page is loaded.
Read more >How to Build an Image Compressor Website using React - Morioh
In this article, I will help you create your own image compressor website using ... match the imageAccept list, or the server returned...
Read more >On a page refresh, my app gives me a TypeError: uid null (react)
It works fine and retrieves details from the auth however when the page is refreshed, it gives this error: TypeError: Cannot read property...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There appears to be some disconnect between server and client apollo
Just adding stuff to the middleware context causes problems with SSR, but adding the same context beneath allows queries to run without crashing. I’ll need to keep digging as I don’t understand why this helps
@tim-soft thank you very much for crating this issue! Unfortunately, we have close it due to inactivity. Feel free to re-open it or join our Discord channel for discussion.
NOTE: The
main
branch has been updated with React Starter Kit v2, using JAM-style architecture.