Releases: RevereCRE/relay-nextjs
v3.0.1
v3.0.0
What's Changed
- Removed
fetchPolicy
configuration option. - Added
queryOptionsFromContext
configuration as a replacement. This new configuration option mirrorsvariablesFromContext
and allows programmatically setting theoptions
argument touseLazyLoadQuery
.
Migration
This section is only relevant if using the fetchPolicy
API. queryOptionsFromContext
has replaced this API, allowing for more configuration options when making the GraphQL request as well as modifying the options based on the query itself. A simple migration looks like:
- fetchPolicy: 'store-or-network',
+ queryOptionsFromContext: () => ({ fetchPolicy: 'store-or-network' })
v2.0.1
v2.0.0
What's Changed
relay-nextjs
has a new API! We no longer require a custom _document.tsx
. The only global configuration needed is a single hook in _app.tsx
:
// pages/_app.tsx
import { getClientEnvironment } from 'lib/relay_client_environment';
import type { AppProps } from 'next/app';
import { RelayEnvironmentProvider } from 'react-relay/hooks';
import { useRelayNextjs } from 'relay-nextjs/app';
import 'tailwindcss/tailwind.css';
function ExampleApp({ Component, pageProps }: AppProps) {
const { env, ...relayProps } = useRelayNextjs(pageProps, {
createClientEnvironment: () => getClientEnvironment()!,
});
return (
<RelayEnvironmentProvider environment={env}>
<Component {...pageProps} {...relayProps} />
</RelayEnvironmentProvider>
);
}
export default ExampleApp;
Please note the page API remains untouched, the only migration needed for v2.0.0 is in _app.tsx
.
Migration Steps
- Remove all usages of
relay-nextjs
in_document.tsx
. - Replace
getInitialPreloadedQuery
andgetRelayProps
withuseRelayNextjs
:
const { env, ...relayProps } = useRelayNextjs(pageProps, {
createClientEnvironment: () => getClientEnvironment()!,
});
- Remove usage of
hydrateRelayEnvironment
andwithHydrateDatetime
. These API's are no longer needed.
v1.0.2
v1.0.1
What's Changed
- Support async getClientInitialProps w backwards compabitible typing by @GioLogist in #77
New Contributors
- @GioLogist made their first contribution in #77
Full Changelog: v1.0.0...v1.0.1
v1.0.0
Breaking changes
hydrateRelayEnvironment
Removed public export of getRelaySerializedState
in favor of new API: hydrateRelayEnvironment
. To migrate remove all calls to getRelaySerializedState
during the creation of Environment
on the client and call the new API directly after instantiation:
clientEnv = new Environment({
network: createClientNetwork(),
store: new Store(new RecordSource()),
isServer: false,
});
hydrateRelayEnvironment(clientEnv);
We don't expect this migration to be difficult, however it is necessary. The old export has been removed so you will get a type error upon upgrading. For more details please see the new API docs and example migration.
__wired__
serialized script
The data serialized into the __wired__
script tag was changed. Previously the entire Relay store was extracted from the server and then rehydrated. The new serialized data shape reduces the amount of bytes transferred over the wire by onlyserializing the initial GraphQL API response. This is rehydrated into the Relay store on the client using commitPayload
. We don't expect this change to impact anyone, if it does please open a new issue or discussion. Note that this change unblocks using Relay resolvers in relay-nextjs
apps.
Full Changelog: v0.10.1...v1.0.0
v0.10.0
What's Changed
- Add serverSidePostQuery hook to access query data + NextContext during SSR by @FINDarkside in #74
Full Changelog: v0.9.0...v0.10.0
v0.9.0
Breaking Changes
- Removed
ErrorComponent
configuration option, prefer using a custom error boundary at the root level of your app (in_app.ts
). - Changed logic for detecting if query variables have changed, this should prevent unintended re-renderings.
Full Changelog: v0.8.0...v0.9.0
v0.8.0
What's Changed
- Upgrade next.js and relay in example by @supaspoida in #50
- Pass error to ErrorComponent by @gio-work in #49
New Contributors
- @supaspoida made their first contribution in #50
- @gio-work made their first contribution in #49
Full Changelog: v0.7.0...v0.8.0