state from server is huge for simple web page
See original GitHub issueHi I am using apollo-client with server side rendering. When I render my simple page I get next state which is send to client. Is it possible to reduce field “queries” somehow because as you can see there is a lot of same queries with same results. Do I need to send field “queries” to client?
{
"apollo": {
"queries": {
"0": {
"queryString": "query viewer {\n viewer {\n id\n }\n}\n",
"query": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"minimizedQueryString": "query viewer {\n viewer {\n id\n }\n}\n",
"minimizedQuery": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"previousVariables": null,
"loading": false,
"stopped": true,
"networkError": null,
"graphQLErrors": null,
"forceFetch": false,
"returnPartialData": false,
"lastRequestId": 1,
"fragmentMap": {}
},
"2": {
"queryString": "query viewer {\n viewer {\n id\n }\n}\n",
"query": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"minimizedQueryString": "query viewer {\n viewer {\n id\n }\n}\n",
"minimizedQuery": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"previousVariables": null,
"loading": false,
"stopped": true,
"networkError": null,
"graphQLErrors": null,
"forceFetch": false,
"returnPartialData": false,
"lastRequestId": 3,
"fragmentMap": {}
},
"4": {
"queryString": "query viewer {\n viewer {\n id\n }\n}\n",
"query": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"minimizedQueryString": "query viewer {\n viewer {\n id\n }\n}\n",
"minimizedQuery": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"previousVariables": null,
"loading": false,
"stopped": true,
"networkError": null,
"graphQLErrors": null,
"forceFetch": false,
"returnPartialData": false,
"lastRequestId": 5,
"fragmentMap": {}
},
"6": {
"queryString": "query viewer {\n viewer {\n id\n }\n}\n",
"query": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"minimizedQueryString": "query viewer {\n viewer {\n id\n }\n}\n",
"minimizedQuery": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"previousVariables": null,
"loading": false,
"stopped": true,
"networkError": null,
"graphQLErrors": null,
"forceFetch": false,
"returnPartialData": false,
"lastRequestId": 7,
"fragmentMap": {}
},
"8": {
"queryString": "query viewer {\n viewer {\n id\n }\n}\n",
"query": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"minimizedQueryString": "query viewer {\n viewer {\n id\n }\n}\n",
"minimizedQuery": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"previousVariables": null,
"loading": false,
"stopped": true,
"networkError": null,
"graphQLErrors": null,
"forceFetch": false,
"returnPartialData": false,
"lastRequestId": 9,
"fragmentMap": {}
},
"10": {
"queryString": "query viewer {\n viewer {\n id\n }\n}\n",
"query": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"minimizedQueryString": "query viewer {\n viewer {\n id\n }\n}\n",
"minimizedQuery": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "viewer"
},
"arguments": [],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"previousVariables": null,
"loading": false,
"stopped": true,
"networkError": null,
"graphQLErrors": null,
"forceFetch": false,
"returnPartialData": false,
"lastRequestId": 11,
"fragmentMap": {}
},
"12": {
"queryString": "query user($id: ID!) {\n user(id: $id) {\n id\n firstName\n }\n}\n",
"query": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "user"
},
"arguments": [{
"kind": "Argument",
"name": {
"kind": "Name",
"value": "id"
},
"value": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "id"
}
}
}],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}, {
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "firstName"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"minimizedQueryString": "query user($id: ID!) {\n user(id: $id) {\n id\n firstName\n }\n}\n",
"minimizedQuery": {
"id": "ROOT_QUERY",
"typeName": "Query",
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "user"
},
"arguments": [{
"kind": "Argument",
"name": {
"kind": "Name",
"value": "id"
},
"value": {
"kind": "Variable",
"name": {
"kind": "Name",
"value": "id"
}
}
}],
"directives": [],
"selectionSet": {
"kind": "SelectionSet",
"selections": [{
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "id"
},
"arguments": [],
"directives": [],
"selectionSet": null
}, {
"kind": "Field",
"alias": null,
"name": {
"kind": "Name",
"value": "firstName"
},
"arguments": [],
"directives": [],
"selectionSet": null
}]
}
}]
}
},
"variables": {
"id": "5"
},
"previousVariables": null,
"loading": false,
"stopped": false,
"networkError": null,
"graphQLErrors": null,
"forceFetch": false,
"returnPartialData": false,
"lastRequestId": 13,
"fragmentMap": {}
}
},
"mutations": {},
"data": {
"undefined:5,": {
"id": "5",
"firstName": "Zlatko"
},
"ROOT_QUERY": {
"viewer": {
"type": "id",
"id": "undefined:5,",
"generated": false
},
"user({\"id\":\"5\"})": {
"type": "id",
"id": "undefined:5,",
"generated": false
}
}
},
"optimistic": []
}
};
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
[Editorial Draft] State in Web application design - W3C
A solution is to have the server sign the state information before it gives it back to the client and verify the integrity...
Read more >What is a web server? - Learn web development | MDN
Sites like MDN or Wikipedia have thousands of webpages. Typically, these kinds of sites are composed of only a few HTML templates and...
Read more >What is a Web Server and How Does it Work? - TechTarget
A free web server from Sun Microsystems that can run on Windows, Linux and Unix. It is well-equipped to handle medium to large...
Read more >What is State Management in ASP.NET? Applications, Types ...
ASP stands for Active Server Pages. It is developed by Microsoft and is a free, Open-Sourced server-side framework for web applications ...
Read more >How To Create a Web Server in Node.js with the HTTP Module
As mentioned before, web servers accept requests from browsers and other clients. We may interact with a web server by entering a domain...
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
ok @stubailo thank you for information I am going to close this ticket and I will watch #666
Not in the next week or so, but we are somewhat redesigning the interaction with Redux for 0.5 so it will be something to start on after that.