Skip to content

`useConnection`: Support local component state as an alternative to Apollo

Created by: umpox

Description

useConnection differs from FilteredConnection in that it uses the Apollo cache to handle pagination rather than local component state.

This has the benefit of improving performance, but for some queries can cause problems that are difficult to debug and makes useConnection harder to migrate to.

We should support local state as an alternative

AC

  • useConnection supports local state through configuration e.g. config.useGlobalCache = false
    • Note: If this introduces a lot more complexity to the component (e.g. having to do a load of type checks to differentiate between the two variants), we could split this into two functions useConnection and useConnectionWithCache
  • It is documented