Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sanity/react-loader

sanity-io147kMIT1.11.11TypeScript support: included

readme

@sanity/react-loader

npm stat npm version gzip size size

npm install @sanity/react-loader @sanity/client react@^18.2

Usage

Server only production data fetching, client side Live Mode

By default data is fetched on both the server, and on the client after hydration. For private datasets, or other similar use cases, it may be desirable to only fetch data on the server when Live Mode is not enabled.

For this to work you'll first have to setup a shared file that is loaded both on the server and the client, which sets ssr: true and defers setting the client to later by setting client: false. The snippets are for a Remix application

// ./src/app/sanity.loader.ts
import {createQueryStore} from '@sanity/react-loader'

export const {
  // Used only server side
  loadQuery,
  setServerClient,
  // Used only client side
  useQuery,
  useLiveMode,
} = createQueryStore({client: false, ssr: true})

You can also use the top-level shortcuts for the same effect:

// ./src/app/sanity.loader.ts

export {
  // Used only server side
  loadQuery,
  setServerClient,
  // Used only client side
  useQuery,
  useLiveMode,
} from '@sanity/react-loader'

Later in the server side of the app, you setup the client. The .server.ts suffix on Remix ensures that this file is only loaded on the server, and it avoids adding @sanity/client to the browser bundle in production.

// ./src/app/sanity.loader.server.ts
import {createClient} from '@sanity/client'
import {loadQuery, setServerClient} from './sanity.loader'

const client = createClient({
  projectId: process.env.SANITY_PROJECT_ID,
  dataset: process.env.SANITY_DATASET,
  useCdn: true,
  apiVersion: process.env.SANITY_API_VERSION,
  stega: {
    enabled: true,
    studioUrl: 'https://my.sanity.studio',
  },
})

setServerClient(client)

// Re-export for convenience
export {loadQuery}

Then somewhere in your app, you can use the loadQuery and useQuery utilities together. useQuery now only fetches data when Live Mode is active. Otherwise it's loadQuery that is used.

// ./src/app/routes/products.$slug.tsx

import {json, type LoaderFunction} from '@remix-run/node'
import {Link, useLoaderData, useParams} from '@remix-run/react'
import {useQuery} from '~/sanity.loader'
import {loadQuery} from '~/sanity.loader.server'

interface Product {}
const query = `*[_type == "product" && slug.current == $slug][0]`

export const loader: LoaderFunction = async ({params}) => {
  return json({
    params,
    initial: await loadQuery<Product>(query, params),
  })
}

export default function ProductPage() {
  const {params, initial} = useLoaderData<typeof loader>()

  if (!params.slug || !initial.data?.slug?.current) {
    throw new Error('No slug, 404?')
  }

  const {data} = useQuery<Product>(query, params, {initial})

  // Use `data` in your view, it'll mirror what the loader returns in production mode,
  // while Live Mode it becomes reactive and respons in real-time to your edits in the Presentation tool.
  return <ProductTemplate data={data} />
}

Enabling Live Mode is done by adding useLiveMode to the same component you're currently calling enableVisualEditing from @sanity/visual-editing:

// ./src/app/VisualEditing.tsx
import {enableVisualEditing, type HistoryUpdate} from '@sanity/visual-editing'
import {useLiveMode} from '~/sanity.loader'
import {useEffect} from 'react'

// A browser client for Live Mode, it's only part of the browser bundle when the `VisualEditing` component is lazy loaded with `React.lazy`
const client = createClient({
  projectId: window.ENV.SANITY_PROJECT_ID,
  dataset: window.ENV.SANITY_DATASET,
  useCdn: true,
  apiVersion: window.ENV.SANITY_API_VERSION,
  stega: {
    enabled: true,
    studioUrl: 'https://my.sanity.studio',
  },
})

export default function VisualEditing() {
  useEffect(
    () =>
      enableVisualEditing({
        history: {
          // setup Remix router integration
        },
      }),
    [],
  )

  useLiveMode({client})

  return null
}

Adding overlays to any element

You can use the encodeDataAttribute function returned by useQuery to create data-sanity attributes, that are picked up by @sanity/visual-editing. This allows you to link to elements that otherwise isn't automatically linked to using @sanity/client, such as array root item, or an image field.

If you aren't using stega and don't have a studioUrl defined in the createClient call, then you add it to the useLiveMode hook:

-useLiveMode({ client })
+useLiveMode({ client, studioUrl: 'https://my.sanity.studio' })

You then use it in your template:

// ./src/app/routes/products.$slug.tsx

import {json, type LoaderFunction} from '@remix-run/node'
import {Link, useLoaderData, useParams} from '@remix-run/react'
import {useQuery} from '@sanity/react-loader'
import {loadQuery} from '~/sanity.loader.server'

interface Product {}
const query = `*[_type == "product" && slug.current == $slug][0]`

export const loader: LoaderFunction = async ({params}) => {
  return json({
    params,
    initial: await loadQuery<Product>(query, params),
  })
}

export default function ProductPage() {
  const {params, initial} = useLoaderData<typeof loader>()

  if (!params.slug || !initial.data?.slug?.current) {
    throw new Error('No slug, 404?')
  }

  const {data, encodeDataAttribute} = useQuery<Product>(query, params, {
    initial,
  })

  // Use `data` in your view, it'll mirror what the loader returns in production mode,
  // while Live Mode it becomes reactive and respons in real-time to your edits in the Presentation tool.
  // And `encodeDataAttribute` is a helpful utility for adding custom `data-sanity` attributes.
  return <ProductTemplate data={data} encodeDataAttribute={encodeDataAttribute} />
}

You use encodeDataAttribute by giving it a path to the data you want to be linked to, or open in the Studio when in the Presentation tool.

// ./src/app/templates/product.tsx
import {EncodeDataAttributeCallback} from '@sanity/react-loader'

interface Product {}

interface Props {
  data: Product
  encodeDataAttribute: EncodeDataAttributeCallback
}
export default function ProductTemplate(props: Props) {
  const {data, encodeDataAttribute} = props
  return (
    <>
      <img
        // Adding this attribute makes sure the image is always clickable in the Presentation tool
        data-sanity={encodeDataAttribute('image')}
        src={urlFor(data.image.asset).url()}
        // other props
      />
    </>
  )
}

changelog

📓 Changelog

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.4.3 to 1.4.4

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.4.4 to 1.4.5

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.5.1 to 1.6.0

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.0 to 1.6.1

1.11.11 (2025-05-29)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.8.10
      • @sanity/visual-editing-csm bumped to 2.0.18

1.11.10 (2025-05-21)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.8.9

1.11.9 (2025-05-07)

Bug Fixes

  • deps: update dependency @sanity/client to v7.1.0 (#2984) (a9f8b89)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.8.8
      • @sanity/visual-editing-csm bumped to 2.0.17

1.11.8 (2025-04-30)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.8.7
      • @sanity/visual-editing-csm bumped to 2.0.16

1.11.7 (2025-04-30)

Bug Fixes

  • deps: update dependency @sanity/client to v7 (#2964) (473f7ed)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.8.6
      • @sanity/visual-editing-csm bumped to 2.0.15

1.11.6 (2025-04-11)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.29.0 (2a8ff1e)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.8.5
      • @sanity/visual-editing-csm bumped to 2.0.14

1.11.5 (2025-04-10)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.8.4

1.11.4 (2025-04-10)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.8.3
      • @sanity/visual-editing-csm bumped to 2.0.13

1.11.3 (2025-04-10)

Bug Fixes

1.11.2 (2025-04-10)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.8.2
      • @sanity/visual-editing-csm bumped to 2.0.12

1.11.1 (2025-04-01)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.28.4 (#2884) (be6dca0)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.8.1
      • @sanity/visual-editing-csm bumped to 2.0.11

1.11.0 (2025-03-24)

Features

  • core-loader: add onPerspective to live mode (#2853) (1acfd65)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.8.0
      • @sanity/visual-editing-csm bumped to 2.0.10

1.10.51 (2025-03-21)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.42

1.10.50 (2025-03-17)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.41
      • @sanity/visual-editing-csm bumped to 2.0.9

1.10.49 (2025-03-14)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.40

1.10.48 (2025-03-12)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.28.2 (#2779) (6336984)
  • deps: update dependency @sanity/client to ^6.28.3 (#2808) (a2f657d)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.39
      • @sanity/visual-editing-csm bumped to 2.0.8

1.10.47 (2025-03-03)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.38
      • @sanity/visual-editing-csm bumped to 2.0.7

1.10.46 (2025-02-24)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.37
      • @sanity/visual-editing-csm bumped to 2.0.6

1.10.45 (2025-02-17)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.36
      • @sanity/visual-editing-csm bumped to 2.0.5

1.10.44 (2025-02-12)

Bug Fixes

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.35

1.10.43 (2025-02-10)

Bug Fixes

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.34
      • @sanity/visual-editing-csm bumped to 2.0.4

1.10.42 (2025-02-07)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.33
      • @sanity/visual-editing-csm bumped to 2.0.3

1.10.41 (2025-01-30)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.32

1.10.40 (2025-01-28)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.27.2 (#2578) (de598b8)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.31
      • @sanity/visual-editing-csm bumped to 2.0.2

1.10.39 (2025-01-22)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.27.0 (main) (#2548) (faeb98f)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.30
      • @sanity/visual-editing-csm bumped to 2.0.1

1.10.38 (2025-01-22)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.26.0 (#2539) (668143a)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.29
      • @sanity/visual-editing-csm bumped to 2.0.0

1.10.37 (2025-01-21)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.28
      • @sanity/visual-editing-csm bumped to 1.0.1

1.10.36 (2025-01-17)

Bug Fixes

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.27
      • @sanity/visual-editing-csm bumped to 1.0.0

1.10.35 (2025-01-14)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.26

1.10.34 (2025-01-09)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.25

1.10.33 (2025-01-09)

Bug Fixes

  • ship react 19 ready typings (67b9187)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.24

1.10.32 (2025-01-06)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.23

1.10.31 (2024-12-21)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.22

1.10.30 (2024-12-16)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.21

1.10.29 (2024-12-16)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.20

1.10.28 (2024-12-05)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.19

1.10.27 (2024-12-03)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.18

1.10.26 (2024-12-03)

Bug Fixes

  • use direct dependency on @sanity/client (43f8d13)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.17

1.10.25 (2024-12-03)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.16

1.10.24 (2024-12-02)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.23.0 (#2244) (eeacde8)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.15

1.10.23 (2024-11-28)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.14

1.10.22 (2024-11-27)

Bug Fixes

1.10.21 (2024-11-26)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.13

1.10.20 (2024-11-19)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.22.5 (#2185) (da0aa32)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.12

1.10.19 (2024-11-14)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.11

1.10.18 (2024-11-12)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.10

1.10.17 (2024-11-12)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.22.4 (#2132) (4f96d9a)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.9

1.10.16 (2024-11-06)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.22.3 (0b78719)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.8

1.10.15 (2024-11-04)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.7

1.10.14 (2024-10-28)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.6

1.10.13 (2024-10-24)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.5

1.10.12 (2024-10-24)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.4

1.10.11 (2024-10-23)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.3

1.10.10 (2024-10-21)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.2

1.10.9 (2024-10-21)

Bug Fixes

  • comlink: handle heartbeat compatibility correctly (#2006) (65af1e1)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.1

1.10.8 (2024-10-21)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.22.2 (8617331)
  • use @sanity/comlink for postMessage events (1c6769a)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.7.0

1.10.7 (2024-09-11)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.21.3 (#1793) (1dc1b1b)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.6.23

1.10.6 (2024-08-12)

Bug Fixes

  • deps: update dependency @sanity/client to v6.21.2 (#1749) (b9efdd2)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.6.22

1.10.5 (2024-08-02)

Bug Fixes

  • deps: update dependency @sanity/client to v6.21.1 (#1704) (32f1ef8)
  • pass tag and headers options to fetch (#1701) (41f8165)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.20 to 1.6.21

1.10.4 (2024-07-03)

Bug Fixes

  • deps: update dependency @sanity/client to v6.20.1 (#1680) (bb89688)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.19 to 1.6.20

1.10.3 (2024-06-13)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.18 to 1.6.19

1.10.2 (2024-06-07)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.17 to 1.6.18

1.10.1 (2024-05-30)

Bug Fixes

  • deps: update dependency @sanity/client to v6.19.1 (#1602) (ebaa50c)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.16 to 1.6.17

1.10.0 (2024-05-29)

Features

1.9.21 (2024-05-28)

Bug Fixes

  • deps: update dependency @sanity/client to v6.19.0 (#1575) (f0094a1)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.15 to 1.6.16

1.9.20 (2024-05-27)

Bug Fixes

  • deps: update dependency @sanity/client to v6.18.3 (#1563) (609a3b1)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.14 to 1.6.15

1.9.19 (2024-05-15)

Bug Fixes

  • deps: update dependency @sanity/client to v6.18.2 (#1519) (78c387e)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.13 to 1.6.14

1.9.18 (2024-05-13)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.12 to 1.6.13

1.9.17 (2024-05-05)

Bug Fixes

  • deps: update dependency @sanity/client to v6.17.2 (#1449) (928b45c)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.11 to 1.6.12

1.9.16 (2024-04-29)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.10 to 1.6.11

1.9.15 (2024-04-26)

Bug Fixes

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.9 to 1.6.10

1.9.14 (2024-04-22)

Bug Fixes

  • deps: update dependency @sanity/client to v6.15.20 (#1385) (8ead6bf)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.8 to 1.6.9

1.9.13 (2024-04-19)

Bug Fixes

  • deps: update dependency @sanity/client to v6.15.19 (#1374) (fde2034)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.7 to 1.6.8

1.9.12 (2024-04-17)

Bug Fixes

  • inline fast-deep-equal for better ESM interop (bacdd48)

1.9.11 (2024-04-17)

Bug Fixes

  • deps: update dependency @sanity/client to v6.15.17 (d203cbd)
  • inline async-cache-dedupe to improve ESM interop (cb53fbd)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.6 to 1.6.7

1.9.10 (2024-04-16)

Bug Fixes

  • deps: update dependency @sanity/client to v6.15.13 (#1327) (a52f2c2)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.5 to 1.6.6

1.9.9 (2024-04-05)

Bug Fixes

  • deps: update dependency @sanity/client to v6.15.11 (#1273) (d2131b7)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.4 to 1.6.5

1.9.8 (2024-04-05)

Bug Fixes

1.9.7 (2024-04-05)

Bug Fixes

  • deps: update dependency @sanity/client to v6.15.10 (#1258) (9bf3cdb)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.3 to 1.6.4

1.9.6 (2024-04-02)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.2 to 1.6.3

1.9.5 (2024-03-20)

Bug Fixes

  • ship TS Node16 compatible typings (a21794d)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.6.1 to 1.6.2

1.9.4 (2024-03-18)

Bug Fixes

  • CSM key order is now stable, workaround no longer necessary (ab45ecc)

1.9.1 (2024-03-01)

Bug Fixes

  • support calling setServerClient more than once (#1034) (14bdd0b)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.5.0 to 1.5.1

1.9.0 (2024-02-27)

Features

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.4.6 to 1.5.0

1.8.8 (2024-02-26)

Bug Fixes

  • deps: update dependency @sanity/client to v6.14.4 (#1002) (1239cb2)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.4.5 to 1.4.6

1.8.5 (2024-02-16)

Bug Fixes

  • deps: update dependency @sanity/client to v6.13.3 (#929) (f711adc)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.4.2 to 1.4.3

1.8.4 (2024-02-15)

Bug Fixes

  • deps: update dependency @sanity/client to v6.13.3 (#921) (e150d8d)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.4.1 to 1.4.2

1.8.3 (2024-02-05)

Bug Fixes

  • rename @sanity/overlays to @sanity/visual-editing (#834) (1d28908)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.4.0 to 1.4.1

1.8.1 (2024-01-29)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.12.3 (#787) (634d8a3)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.3.9 to 1.3.10

1.8.0 (2024-01-26)

Features

Bug Fixes

  • deps: update dependency @sanity/client to ^6.11.2 (#745) (7f24dd6)
  • deps: update dependency @sanity/client to ^6.11.3 (#755) (148ce5a)
  • deps: update dependency @sanity/client to ^6.12.1 (782f51e)
  • deps: update dependency @sanity/client to ^6.12.1 (#774) (4ba2074)
  • don't serialize initial with undefined values (10c5ff7)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.3.8 to 1.3.9

1.7.4 (2024-01-10)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.11.1 (#666) (487d552)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.3.5 to 1.3.6

1.7.3 (2024-01-10)

Bug Fixes

  • use client perspective in loadQuery if not passed explicitly (#661) (c210633)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.3.4 to 1.3.5

1.7.2 (2024-01-10)

Bug Fixes

  • replace react-fast-compare with fast-deep-equal to reduce bundle (574d8ae)

1.7.1 (2024-01-10)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.11.0 (#649) (b94f848)
  • workaround issue where CSM randomly reordering paths causes excessive rerenders (d6341ee)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.3.3 to 1.3.4
    • devDependencies

1.7.0 (2024-01-05)

Features

  • react-loader: add stega and useCdn options to loadQuery (#626) (ae9618e)

1.6.2 (2023-12-13)

Bug Fixes

  • perf: move isEqual check to @sanity/react-loader (00330a7)

1.6.1 (2023-12-13)

Bug Fixes

  • useQuery: export correct typing for encodeDataAttribute (eab977b)

1.6.0 (2023-12-12)

Features

  • add .scope method to encodeDataAttribute function (#557) (61e03da)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.2.0 to 1.3.0

1.5.0 (2023-12-12)

Features

  • channels: simplify implementation and API (#542) (4854e7f)

Bug Fixes

  • deprecate allowStudioOrigin, as it's no longer needed (7ad52a0)
  • deps: update dependency @sanity/client to ^6.10.0 (#551) (5dc24c9)
  • loadQuery: add cache and next typings (#554) (70ff1b0)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.1.4 to 1.2.0
    • devDependencies

1.4.0 (2023-12-08)

Features

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.1.3 to 1.1.4

1.3.1 (2023-12-07)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.9.3 (#517) (39528c8)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.1.2 to 1.1.3

1.3.0 (2023-12-06)

Features

  • add top-level setServerClient, loadQuery, useQuery & useLiveMode exports (79fd84e)
  • add top-level shortcuts for server-only data fetching (#505) (0345040)

Bug Fixes

  • add RSC support to main export (#504) (f9fd0e7)
  • RSC: also support server components on the main route (73d5296)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.1.1 to 1.1.2

1.2.0 (2023-12-05)

Features

Bug Fixes

  • types: add missing exports (fd52637)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped from 1.0.3 to 1.1.0

1.1.3 (2023-11-30)

Bug Fixes

  • useQuery: snapshot state is now updated when initial changes (#444) (a0e2d38)

1.1.2 (2023-11-29)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.9.0 (#434) (c7c8ec5)
  • deps: update dependency @sanity/client to ^6.9.1 (#437) (6974b0d)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.0.3

1.1.1 (2023-11-27)

Bug Fixes

  • set tag in fetch and listen methods (4867aee)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.0.2

1.1.0 (2023-11-20)

Features

  • typings: only set data as optionally undefined if initial.data isn't provided (fb24f66)

1.0.2 (2023-11-16)

Bug Fixes

  • docs: remove experimental badges (874d884)

1.0.1 (2023-11-16)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.8.6 (#374) (f62967a)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.0.1

1.0.0 (2023-11-15)

Features

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 1.0.0

0.11.0-pink-lizard (2023-11-15)

⚠ BREAKING CHANGES

  • rename query to loadQuery

Bug Fixes

  • docs: add docs for encodeDataAttribute (0686612)
  • rename query to loadQuery (228dfc3)

0.10.0-pink-lizard (2023-11-13)

Features

  • add encodeDataAttribute API (d9179f3)

Bug Fixes

  • deps: Update dependency @sanity/client to ^6.8.2 (#356) (b80dfa5)
  • deps: Update dependency @sanity/client to ^6.8.4 (5dbbe06)
  • deps: Update dependency @sanity/client to ^6.8.5 (#361) (e8e61c1)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 0.9.0-pink-lizard

0.9.2-pink-lizard (2023-11-13)

Bug Fixes

  • deps: Update dependency @sanity/client to ^6.8.1 (#351) (6efe86f)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 0.8.1-pink-lizard

0.9.1-pink-lizard (2023-11-11)

Bug Fixes

0.9.0-pink-lizard (2023-11-11)

⚠ BREAKING CHANGES

  • replace setServerDraftMode with perspective on query

Features

  • add /rsc export for app router and React Server Components (309756f)
  • add setServerDraftMode API (9c5dd76)
  • replace setServerDraftMode with perspective on query (017d02f)

Bug Fixes

  • add types for cache and next (399feca)
  • disable cache by default (0fa8e59)
  • set useCdn based on cache settings (8d22260)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 0.8.0-pink-lizard

0.8.2-pink-lizard (2023-11-10)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.8.0 (4e11e0c)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 0.7.5-pink-lizard

0.8.0-pink-lizard (2023-11-09)

⚠ BREAKING CHANGES

  • remove startTransition option

Bug Fixes

  • remove startTransition option (25268ed)
  • set initial loading to false when hydrated (415c2f5)
  • set initial hydrated state consistently (4d9676c)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 0.7.3-pink-lizard

0.7.2-pink-lizard (2023-11-08)

Bug Fixes

  • deps: update dependency @sanity/client to v6.8.0-pink-lizard.12 (#301) (c939d32)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 0.7.2-pink-lizard

0.7.1-pink-lizard (2023-11-08)

Bug Fixes

  • deps: update dependency @sanity/client to v6.8.0-pink-lizard.12 (#298) (4bfbfff)
  • README: document SSR mode (718f84a)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 0.7.1-pink-lizard

0.7.0-pink-lizard (2023-11-08)

⚠ BREAKING CHANGES

  • initialData and initialSourceMap are now grouped by initial

Bug Fixes

  • initialData and initialSourceMap are now grouped by initial (30f8cfd)
  • deps: update dependency @sanity/client to v6.8.0-pink-lizard.9 (#295) (6335f36)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 0.7.0-pink-lizard

0.6.0-pink-lizard (2023-11-08)

Features

Bug Fixes

  • deps: update dependency @sanity/client to v6.8.0-pink-lizard.8 (#291) (9623639)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 0.6.0-pink-lizard

0.5.3-pink-lizard (2023-11-08)

Bug Fixes

  • deps: update dependency @sanity/client to v6.8.0-pink-lizard.7 (#288) (7d63682)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 0.5.3-pink-lizard

0.5.2-pink-lizard (2023-11-08)

Bug Fixes

  • deps: update dependency @sanity/client to v6.8.0-pink-lizard.5 (c88e4ec)

Dependencies

  • The following workspace dependencies were updated
    • dependencies
      • @sanity/core-loader bumped to 0.5.2-pink-lizard

0.5.0-pink-lizard (2023-11-08)

⚠ BREAKING CHANGES

  • lazy load live mode (#281)

Bug Fixes

0.4.3-pink-lizard (2023-11-07)

Bug Fixes

  • deps: update dependency @sanity/client to v6.8.0-pink-lizard.4 (#278) (f9a64c4)

0.4.2-pink-lizard (2023-11-07)

Bug Fixes

  • deps: update dependency @sanity/client to v6.8.0-pink-lizard.3 (#267) (432f47b)
  • use new ContentSourceMapParsedPathKeyedSegment format (20b3186)

0.4.1-pink-lizard (2023-11-05)

Bug Fixes

  • deps: update dependency @sanity/client to v6.8.0-pink-lizard.0 (#264) (010b87a)

0.4.0-pink-lizard (2023-11-04)

Features

  • use the new @sanity/client/stega features (#252) (fa08bb2)

Bug Fixes

  • handle stega nodes in a way that supports focus (#254) (dce801f)

0.3.5-pink-lizard (2023-11-03)

Bug Fixes

  • include sourceMap on query() result (9f90f04)

0.3.4-pink-lizard (2023-11-02)

Bug Fixes

  • export encodeSanityNodeData (4d78837)

0.3.3-pink-lizard (2023-11-02)

Bug Fixes

  • README: add badges and links (0fcf516)

0.3.2-pink-lizard (2023-11-02)

Bug Fixes

  • deps: pin dependencies (#239) (e1583b9)
  • remove @sanity/overlays as peer dep (5a2f806)
  • set @sanity/core-loader as typical dep (3f2dd24)

0.3.1-pink-lizard (2023-11-02)

Bug Fixes

0.3.0-pink-lizard (2023-10-25)

Features

  • add query API for React SSR (e86ce61)

Bug Fixes

  • deps: upgrade @sanity/pkg-utils (9236c86)

0.2.1-pink-lizard (2023-10-24)

Bug Fixes

  • set loading to true even when initial data is used (cd4ce21)
  • temp disable minify for debugging (93265ae)

0.2.0-pink-lizard (2023-10-24)

Features

0.1.8-pink-lizard (2023-10-23)

Bug Fixes

  • disable minification to ease debugging (666f8e0)

0.1.7-pink-lizard (2023-10-23)

Bug Fixes

  • generate typings from bundled packages (8201fa7)

0.1.6-pink-lizard (2023-10-23)

Bug Fixes

  • add typings for options (88e27e4)
  • remove debug console loggers (84f4b1d)
  • resolve keyed array paths correctly (4a83fe6)

0.1.5-pink-lizard (2023-10-23)

Bug Fixes

  • add support for initialData and initialSourceMap (808dc00)

0.1.4-pink-lizard (2023-10-23)

Bug Fixes

  • pink-lizard: remove unnecessary suffix (c7409aa)

0.1.3-pink-lizard.0 (2023-10-19)

Bug Fixes

0.1.2-pink-lizard.0 (2023-10-19)

Bug Fixes

  • include CHANGELOG.md files in private packages (9967f1c)

0.1.1-pink-lizard.0 (2023-10-19)

Bug Fixes

  • deps: update dependency @sanity/client to ^6.7.0 (85d542f)
  • replace useSyncExternalStore with useEffect (c680240)

0.1.0-pink-lizard.0 (2023-10-19)

Features

Bug Fixes

  • add @sanity/client to peer deps (acf0bd0)
  • correctly handle channel target origins (#117) (67a66fb)
  • initial @sanity/react-loader (726d818)
  • setup loaders channel (20971aa)