Skip to content

Commit

Permalink
fix(Sanity): use <Studio> instead of render studio since it seems mor…
Browse files Browse the repository at this point in the history
…e stable
  • Loading branch information
EmilEinarsen committed Jan 22, 2023
1 parent 6d9de6d commit bdd0581
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions app/routes/studio/$.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import { useRef, useEffect } from 'react'
import { renderStudio } from 'sanity'
import {ClientOnly} from 'remix-utils'
import { Studio } from 'sanity'
import { config } from 'sanity.config'

export const handle = {
hydrate: true
}

export default function Studio() {
const studioRef = useRef<HTMLDivElement>(null)
useEffect(() => {
renderStudio(studioRef.current, config)
}, [])

export default function StudioPage() {
return (
<>
<div ref={studioRef} style={{ height: '100vh' }} />
</>
<ClientOnly>
{() => (
<div style={{ height: '100vh' }}>
<Studio

config={config}
// To enable guests view-only access to your Studio,
// uncomment this line!
// unstable_noAuthBoundary
/>
</div>
)}
</ClientOnly>
)
}

0 comments on commit bdd0581

Please sign in to comment.