Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Releases: jxom/react-loads

9.0.1

18 Dec 10:26
Compare
Choose a tag to compare

Patches

  • Fix issue where isPending wasn't truthy for useDeferredLoads: eff93d0

9.0.0

18 Dec 10:10
Compare
Choose a tag to compare

BREAKING CHANGES

  • There is a new useLoads API where context is now mandatory.

    v8 and below

    useLoads(fn, config)

    v9

    useLoads(context, fn, config)
    • With this change, this means that every response gets automatically stored in the cache.
    • There may be instances where you don't want to use the automatic caching, you can disable it by setting loadPolicy: 'load-only' in the useLoads config.
    • Read more on it's usage
  • Removed the id & args attributes from the useLoads config options in favor of a variables option

    v8 and below

    useLoads(fn, { 
      id: [fooId, barId], 
      args: [fooId, barId, { baz: 'hello' }] 
    })

    v9

    useLoads(context, fn, {
      variables: [fooId, barId, { baz: 'hello' }]
    })
  • Removed isTimeout in favour of isPendingSlow

  • Removed enableBackgroundStates in favour of isReloading

  • Renamed the load prop to fn in <Loads>

    v8 and below

    <Loads load={fetchDogs}>

    v9

    <Loads fn={fetchDogs}
  • Renamed the _namespace & load attributes in createResource to context & fn

    v8 and below

    createResource({
      _namespace: 'foo',
      load: fetchFoo
    })

    v9

    createResource({
      context: 'foo',
      fn: fetchFoo
    })
  • Configuration is now placed in a config prop on <Provider>

    v8 and below

    <Loads.Provider timeout={500}>
      {/* ... */}
    </Loads.Provider>

    v9

    const config = { timeout: 500 };
    
    function App() {
      return (
        <Loads.Provider timeout={500}>
          {/* ... */}
        </Loads.Provider>
       );
     }
  • Removed useLoadsCache in favour of useCache

  • Removed state components (<Loads.Pending>, <Loads.Resolved>, etc)

    • Use state variables (isPending, isResolved, etc) instead

Features

  • Introduced a new useDeferredLoads hook.
    • This replicates the old useLoads(fn, { defer: true }), but useDeferredLoads doesn't require a context.
    • Read more on it's usage
  • Added a new isReloading state
    • This is truthy when the async function is reloading (typically when fn is manually invoked, or data exists in the cache)
  • Add polling support
  • Add deduping support
  • Added new config options:
    • variables
    • cacheStrategy
    • cacheTime
    • dedupingInterval
    • onReject
    • onResolve
    • pollingInterval
    • pollWhenHidden
    • rejectRetryInterval
    • revalidateTime
    • revalidateOnWindowFocus
  • Introduced a new useGetStates hook to compose promise states. Read more
  • Introduced a new preload function for preloading data. Read more

8.4.0

31 Oct 11:59
Compare
Choose a tag to compare

Features

  • Added a suspense config option to useLoads - allowing useLoads to support React's Suspense API. See more: bc9f43e

8.3.8

14 Aug 03:21
Compare
Choose a tag to compare

Patches

  • Fix stale records being shown: ae38087

8.3.7

13 Aug 05:04
Compare
Choose a tag to compare

Patches

  • Fix issue where records weren't being reset on context change: 7863ff2

8.3.6

07 Aug 03:10
Compare
Choose a tag to compare

Patches

  • Add ability to reset state with reset(): 0a711e4
    • E.g. const { reset } = useLoads(...)

8.3.4

11 Jul 12:48
Compare
Choose a tag to compare

Patches

  • Fix stale data issues with cache provider: 93b3754

8.3.3

11 Jul 12:49
Compare
Choose a tag to compare

Patches

  • Added throwError option to useLoads

8.3.2

11 Jul 12:49
Compare
Choose a tag to compare

Patches

  • Add ability to supply an array of ids to useLoads

v8.3.1

11 Jul 12:49
Compare
Choose a tag to compare

Patches

  • Use the inputs arg as a dependency to the load useEffect