function Root({children}: {children: React.ReactNode}) {
const applicationId = useApplicationId()
return applicationId ? <Scoped applicationId={applicationId}>{children}</Scoped> : children
}
function Scoped({applicationId, children}: {applicationId: string; children: React.ReactNode}) {
const application = useApplication(applicationId)
return <div className={application?.slug ?? undefined}>{children}</div>
}
Returns the id this application connected to the Dashboard message bus with, or
nulloutside a Dashboard. The Sanity CLI embeds it at build time.sanity deployembeds the deployed application id andsanity devthe slug, so pass it to useApplication to read the application's details. An installed application is listed under its installation id, souseApplicationreturnsnullfor it.