Querying Data
Query and display data in your app UI
App UIs query data with the useData hook, which provides real-time updates as
data changes in your workspace.
useData hook
Pass a filter object to useData. All fields are optional — calling useData()
with no arguments returns all data for the current server.
Filter params
| Param | Type | Description |
|---|---|---|
kindFilter | string | Filter by kind |
statusFilter | string | Filter by status |
keyFilter | string | Search keys (case-insensitive) |
appIdFilter | string | Filter by app install |
channelId | string | Filter by channel |
sortColumn | string | Column to sort by |
sortDirection | string | 'asc' or 'desc' |
limit | number | Max results (may be capped) |
Return value
The hook returns a [data, actions] tuple:
data— array of matching rowsmutate(row)— update a data rowdelete(id)— delete a data row by id
Block queries
Blocks use string queries to fetch data. These follow the {app}-{metric}
naming convention for keys and categories:
DataTable
For a full-featured data browsing UI, use the DataTable component:
DataTable provides multi-column sorting, filtering by key/value/kind/status, column visibility toggle, row selection with bulk operations, expanded row view, and JSON formatting.
Mini block useData
Mini blocks use a simpler version of
useData that returns data for the current app install only, limited to 10
items, with no query parameters: