Releases
Fetch and display published app releases with the Mite SDK.
Fetch the releases you have published in Mite, optionally filtered by platform. To show release notes to users automatically after an update, see What's New — it is built on top of this.
Using the hook
import { useReleases } from '@usemite/sdk'
export default function ReleasesScreen() {
const { releases, loading, error, refetch } = useReleases({
platform: 'ios',
limit: 10,
enabled: true,
})
if (loading) return <Text>Loading...</Text>
if (error) return <Text>Error: {error.message}</Text>
return (
<FlatList
data={releases}
keyExtractor={item => item.id}
renderItem={({ item }) => (
<View>
<Text>{item.version} (Build {item.versionCode})</Text>
<Text>{item.notes}</Text>
</View>
)}
onRefresh={refetch}
refreshing={loading}
/>
)
}enabled defaults to false. The hook fetches nothing until you pass
enabled: true. This makes it easy to defer the request until a screen is
actually visible — but it also means omitting the option gives you an empty
list, not a loading state.
Options
| Option | Type | Default | Description |
|---|---|---|---|
platform | 'ios' | 'android' | 'all' | unset | Filter by platform. When omitted, no filter is sent and the server decides |
limit | number | unset | Max number of releases to return |
enabled | boolean | false | Fetch on mount, and refetch when the options change |
Return value
| Field | Type | Description |
|---|---|---|
releases | Release[] | Fetched releases, [] until loaded |
loading | boolean | Whether a fetch is in flight. Starts as the value of enabled |
error | Error | null | Error from the last fetch |
refetch | () => Promise<void> | Fetch again, regardless of enabled |
refetch never rejects — failures land on error and are logged as
[Mite] useReleases error:. That makes it safe to pass straight to
onRefresh.
Direct API access
import { useMite } from '@usemite/sdk'
const mite = useMite()
const releases = await mite.getReleases({
platform: 'android',
limit: 5,
})Unlike the hook, getReleases throws on failure. Both platform and limit
are optional; omitted options are left off the query string entirely.
The Release object
interface Release {
id: string
version: string
versionCode: number
platform: 'ios' | 'android' | 'all'
notes?: string
releasedAt?: number
createdAt: number
}| Field | Description |
|---|---|
id | Unique release identifier |
version | Human-readable version, e.g. 1.4.0. Matched against the installed app version by What's New |
versionCode | Numeric build number |
platform | Target platform, or all |
notes | Release notes. Supports a markdown subset |
releasedAt | Publish timestamp in ms, when set |
createdAt | Creation timestamp in ms |