Loading bug and static types!
This is the first large release since I've started back maintaining react-apollo again 💯
Fixes
- After the introduction of recycled queries (react-apollo 1.0.1), a persistent loading bug was present which impacted cached queries on remount. This was particularly painful for projects with heavy routing based queries (which are most projects). The fix for this bug required a fix/hack in apollo client. As well as in react-apollo.
In the future, the current recycled queries implementation will most likely be removed for a context based solution in just react-apollo. (No outward api changes should be needed)
- Render full markup on the server when using the
cache-and-network
fetchPolicy PR #688
Features
A couple fun ones in this release targeting developer experience and a slight lightening of the build size.
-
Support for tree shaking which makes is possible to only bundle what you use. In react-apollo this doesn't save a ton unless you are not using
graphql
HOC -
Enhanced types for typescript to give type checking for ehancers.
- Type query results and expect their values in the the wrapped component
- Safely use the
options
function based on props passed to wrapped component
- Safely build props based on result data, passed props, and what react-apollo passes down
- Initial types for flow! to give type checking for ehancers.
- Type query results and expect their values in the the wrapped component
- Safely use the
options
function based on props passed to wrapped component
- Safely build props based on result data, passed props, and what react-apollo passes down
Known flow issues
- Options as a function or and object is not currently supported. With union types in flow, I couldn't get an interface with all optional params to be distinguishable from a callable arrow function which returns said interface. For now, only the function version is allowed.
- Result data which could be null, is typed as existing. I tried to get result data being optional
QueryProps & ?R
but then I couldn't get flow to pass something likedata.code && // use data.code
. If you have any knowledge here I'd love it!
A huge thank you to @helfer, @lewisf, @brettjurgens, @ianks, and @stubailo for help with these features
Also, its the first time in a while apollo-client and react-apollo have the same version!