Skip to content

v1.0.7

Choose a tag to compare

@debabin debabin released this 06 Jul 09:23
· 89 commits to main since this release

Improve async and connection hooks

This release improves retry handling across async hooks, makes polling and reconnection more flexible, and adds constraint control to the device list hook.

Features

  • useQuery — reworked the retry logic so retry now accepts a function (failureCount, error) => boolean in addition to a boolean or number, letting you decide whether to retry based on the failure count or the error itself.
  • useQuery — updated refetchInterval to accept a function returning the next interval, or false to stop polling, enabling conditional polling that ends once a condition is met.
  • useWebSocket — reworked the retry logic so retry now accepts a function (failureCount, event) => boolean in addition to a boolean or number, giving full control over reconnection based on the failure count or the close event.
  • useWebSocket — added the immediately option to control whether the connection opens on mount, allowing the socket to be opened manually through open() when set to false.
  • useWebSocket — renamed the onDisconnected callback to onClose to align with the native WebSocket close event.
  • useDeviceList — added support for default constraints through options and per-call constraints through trigger(constraints), giving finer control over which permissions are requested when reading the device list.