Adds refreshes data on tab focus and current user attributes

Published: November 25, 2026

v3.16.0

Dashboard view hooks and types, which are in beta, return a new shape, so apps that use them need code changes when they upgrade. Apps can now read the signed-in user's attributes, and, in beta, cached data refreshes when someone returns to the tab.

New features

Refresh data when someone returns to the tab

When someone comes back to an app's tab, cached data the app shows, such as projects, applications and preferences, is fetched again if it's more than 30 seconds old. Changes made elsewhere show without a reload. This option is in beta, on by default, and can add API requests. If more than one SDK instance on the page shows the same data, the instance that started showing it last decides. To turn it off, set refetchOnWindowFocus to false in the app's config:

import type {SanityConfig} from '@sanity/sdk'

export const config: SanityConfig = {
  projectId: '',
  dataset: 'production',
  refetchOnWindowFocus: false,
}

Read the current user's attributes

Set auth.includeUserAttributes to true in your app config and useCurrentUser returns the signed-in user's attributes as attributes. The attributes belong to the organization from the Dashboard context, or to the organizationId in your config. attributes is missing when the user isn't a member of that organization or the token doesn't cover it.

import type {SanityConfig} from '@sanity/sdk'
import {useCurrentUser} from '@sanity/sdk-react'

export const config: SanityConfig = {
  projectId: '',
  dataset: 'production',
  auth: {includeUserAttributes: true},
}

export function Team() {
  const user = useCurrentUser()
  const team = user?.attributes?.find((attribute) => attribute.key === 'team')

  return <span>{team?.value}</span>
}

Improvements

  • Preferences: useUserPreference and useUserPreferenceList accept a refetchInterval option. Pass a number of milliseconds to change the polling interval, or false to stop polling. Polling stays at 60 seconds by default. The userPreference and userPreferenceList fetchers in @sanity/sdk accept it too.
  • Installations: an installation's application has updatedAt, when the installed app last changed. Pass organization in include to also get application.organization.logoUrl, the logo of the organization that publishes the app.
  • Projects: projects from the project and projects APIs include logoUrl, the CDN URL of the project's logo, or null when it has none.
  • Documents: the first document change is sent to the API without the one-second wait. Repeated edits are still batched, and pending edits are sent before a publish, in the order you made them.

Fixes

  • Cached data: hundreds of components waiting on the same cached data, like a row each in a long table, no longer report "Maximum call stack size exceeded" when the data arrives. The data is cleaned up once the components unmount.
Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change site theme