Skip to content

Releases: relay-tools/relay-hooks

v3.5.2

21 Jul 13:10
Compare
Choose a tag to compare

Fixed

  • #99 added relay-runtime types dependency in order to fix d.ts files

Improved

  • #100 added example with react experimental nextjs-ssr example
    • upgrade next to version 9.4.4
    • upgrade react and react-dom to experimental
    • add reactMode as concurrent on next.config.js
    • remove Suspense Component and use just Suspense oficial api.
    • remove ssr param at withData

such changes also work if you use react-relay/hooks

v3.5.1

03 Jul 16:13
Compare
Choose a tag to compare

Fixed

  • #93 fix connection config typing
  • #92 fix loadMore & refetchConnection arguments typing

v3.5.0

25 May 08:13
82d499d
Compare
Choose a tag to compare

Improved

v3.4.0

02 May 12:45
Compare
Choose a tag to compare

Improved

  • Improved typing
  • useRefetchable increase performance with useMemo

Misc

  • QueryFetcher & FragmentResolver: removed the operation parameter in the lookup
  • FragmentResolver changed subscription to dispose

v3.3.0

04 Apr 10:59
cf83b96
Compare
Choose a tag to compare

Improved

  • added useSubscription hook #70

Improved codebase

  • added CRA example #79
  • move tests to typescript #80
  • clean up imports and added new eslint rules #77
  • added CI github action #67

Fixed

  • make pagination functions stable #66
  • change skip return, now return undefined as for data not found in store #69
  • typing useQuery & useLazyLoadQuery #69

v3.2.0

15 Mar 22:12
Compare
Choose a tag to compare

Improved

  • conditional useQuery & useLazyLoadQuery: added skip: [Optional] If skip is true, the query will be skipped entirely #57
  • Make variables optional in useQuery & useLazyLoadQuery #62
  • Make options optional in useQuery & useLazyLoadQuery #61
  • better typing in usePagination, useRefetch, useRefetchable #58

v3.1.0

01 Mar 19:21
5b1be9d
Compare
Choose a tag to compare

Improved

  • support relay-runtime v8 & v9 #55

v3.0.0

08 Feb 12:37
Compare
Choose a tag to compare

Improved

  • support relay-runtime v8.0.0, now required "relay-runtime": ">=8.0.0" 1cc3560
  • create useLazyLoadQuery 98d0f27
  • improved queryFetcher & useQueryFetcher to handle both useQuery (no suspense) and useLazyLoadQuery (with suspense) 75bccc9
  • added tests from relay-experimental 5cdc866
  • created nextjs example with ssr & useLazyLoadQuery
  • created useRefetchable c2f671b
  • added tests for useRefetchable

v2.1.0

22 Dec 16:37
Compare
Choose a tag to compare

Improved

  • useMutation typing #48
  • useOssFragment, useFragment, useRefetch & usePagination typing #41
  • Add fetchKey property in useQuery #47
  • Added nextjs - ssr typescript example #21
  • export RelayHooksType in index.ts

v2.0.0

24 Nov 19:01
Compare
Choose a tag to compare

Improved

  • added 154 tests of react-relay (useMutation tests are missing) #2
  • verified compatibility with react-relay 7.1.0 #45
  • added eslint
  • added prettier
  • usePagination supports react-relay v7 #44
  • some fix (thanks to tests)
  • refactor useOssFragment (too complex)
  • removed react-relay dependency
  • test with react-relay-offline
  • more test useRefetch & usePagination
  • test with react-relay 6.0.0
  • peerDependency "relay-runtime": ">=6.0.0"

Breaking change

  • useQuery:
export const NETWORK_ONLY = 'network-only';
export const STORE_THEN_NETWORK = 'store-and-network';
export const STORE_OR_NETWORK = 'store-or-network';
export const STORE_ONLY = 'store-only';

export type FetchPolicy = 'store-only' | 'store-or-network' | 'store-and-network' | 'network-only';


export type QueryOptions = {
    fetchPolicy?: FetchPolicy;
    networkCacheConfig?: CacheConfig;
};

useQuery: <TOperationType extends OperationType>(
    gqlQuery: GraphQLTaggedNode,
    variables: TOperationType['variables'],
    options: QueryOptions,
) => RenderProps<TOperationType>

example:

const {props, error, retry, cached} = useQuery(
    QueryApp,
    {userId},
    {
      fetchPolicy: 'store-and-network',
    },
  );