Skip to Content

Available on client only

useSync(basicFilter: EqualityFilter, syncOptions: SyncOptions, hookOptions?: HookOptions): AsyncResult

Retrieves rows matching the filter and keeps them in sync

  • use { handlesOnData: true } to get optimistic updates method: $update
  • any changes to the row using the $update method will be reflected instantly to all sync subscribers that were initiated with the same syncOptions

Parameters

  • basicFilter required EqualityFilter

    Filter used for data synchronization, where all specified columns must match the given values.

    Columns are combined using an AND condition.

    Example: { department: 'd1', name: 'abc' } would match records where department is ‘d1’ AND name is ‘abc’.

  • syncOptions required SyncOptions

  • hookOptions optional HookOptions

    • skip optional boolean

      Used to prevent the hook from fetching data

    • deps optional any[] | undefined

      Used to trigger re-fetching

Return type

AsyncResult

Async result type:

  • data: the expected data
  • isLoading: true when data is being fetched (initially or on subsequent filter/option changes)
  • error: any error that occurred
Last updated on