Build activity indicators and badges with information about a location and its threads
import { thread } from '@cord-sdk/react';
const summary = thread.useLocationSummary(location, options);
import { thread } from '@cord-sdk/react';
const summary = thread.useLocationSummary({page: 'document_details'}, {partialMatch: true});
return (
<div>
{!summary && "Loading..."}
{summary && (
<p>Total threads: {summary.total}</p>
<p>Unread threads: {summary.unread}</p>
<p>Unread subscribed threads: {summary.unreadSubscribed}</p>
<p>Resolved threads: {summary.resolved}</p>
)}
</div>
);
The API provides an object which has the following fields:
unreadSubscribed
is always less than or equal to unread
.undefined
while the data loads from our API. Once it has loaded, your component will re-render and the hook will return an object containing the fields described under "Available Data" above. The component will automatically re-render if any of the data changes, i.e., this data is always "live".true
, perform partial matching on the specified location. If false
, fetch information for only exactly the location specified.false
.