Skip to content

Releases: RevereCRE/relay-nextjs

v3.0.1

15 Aug 19:19
Compare
Choose a tag to compare

What Changed

  • Updated default fetchPolicy to store-or-network.
  • Fixed bug when determining default variables from context.

v3.0.0

15 Aug 18:03
Compare
Choose a tag to compare

What's Changed

  • Removed fetchPolicy configuration option.
  • Added queryOptionsFromContext configuration as a replacement. This new configuration option mirrors variablesFromContext and allows programmatically setting the options argument to useLazyLoadQuery.

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

23 May 21:19
Compare
Choose a tag to compare

What's Changed

Configuration API's from v1 have been restored! The following options are once again available:

  • fetchPolicy
  • serverSidePostQuery

v2.0.0

16 May 20:23
Compare
Choose a tag to compare

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

Example Migration

  1. Remove all usages of relay-nextjs in _document.tsx.
  2. Replace getInitialPreloadedQuery and getRelayProps with useRelayNextjs:
  const { env, ...relayProps } = useRelayNextjs(pageProps, {
    createClientEnvironment: () => getClientEnvironment()!,
  });
  1. Remove usage of hydrateRelayEnvironment and withHydrateDatetime. These API's are no longer needed.

v1.0.2

03 Feb 23:11
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.0.1...v1.0.2

v1.0.1

29 Nov 16:45
Compare
Choose a tag to compare

What's Changed

  • Support async getClientInitialProps w backwards compabitible typing by @GioLogist in #77

New Contributors

Full Changelog: v1.0.0...v1.0.1

v1.0.0

22 Nov 20:16
Compare
Choose a tag to compare

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

07 Sep 15:06
Compare
Choose a tag to compare

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

18 Aug 15:47
Compare
Choose a tag to compare

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

03 Mar 00:28
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.7.0...v0.8.0