Skip to content

fix(deps): update sanity packages#1710

Open
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/sanity-packages
Open

fix(deps): update sanity packages#1710
renovate[bot] wants to merge 1 commit into
mainfrom
renovate/sanity-packages

Conversation

@renovate
Copy link
Copy Markdown
Contributor

@renovate renovate Bot commented Mar 6, 2026

This PR contains the following updates:

Package Change Age Confidence
@portabletext/react 6.0.36.2.0 age confidence
@sanity/assist (source) 6.0.46.0.5 age confidence
@sanity/preview-url-secret (source) 4.0.54.0.6 age confidence
@sanity/vision (source) 5.22.05.24.0 age confidence
groq (source) 5.22.05.24.0 age confidence
sanity (source) 5.22.05.24.0 age confidence

Release Notes

portabletext/react-portabletext (@​portabletext/react)

v6.2.0

Compare Source

Minor Changes
  • #​309 575c9b4 Thanks @​stipsan! - TypeGen-aware Portable Text components

    <PortableText> now infers the shape of every component handler from the value prop. When you pass a value typed by Sanity TypeGen, components.types, components.marks, components.block, components.list, and components.listItem all receive precise value props for the exact content the query returned.

    Three new utility types ship with this feature:

    • InferComponents<T> - same inference as the inline components prop, for hoisting components out of JSX.
    • InferStrictComponents<T> - strict variant that requires a handler for every inferred custom type, mark, block style, and list style, and rejects handlers that aren't in the schema (and therefore not visible to TypeGen).
    • InferValue<T> - derives a Portable Text array value type from any TypeGen query result type, useful for re-usable wrapper components.
Schema

Every example below assumes the same sanity.config.ts:

// sanity.config.ts
import {
  defineArrayMember,
  defineConfig,
  defineField,
  defineType,
} from "sanity";

export default defineConfig({
  name: "default",
  projectId: "abc123",
  dataset: "production",
  schema: {
    types: [
      defineType({
        name: "post",
        type: "document",
        fields: [
          defineField({ name: "title", type: "string" }),
          defineField({
            name: "content",
            type: "array",
            of: [
              defineArrayMember({ type: "block" }),
              defineArrayMember({
                type: "image",
                options: { hotspot: true },
                fields: [defineField({ name: "alt", type: "string" })],
              }),
            ],
          }),
        ],
      }),
    ],
  },
});
Before: hand-typing handlers

Previously, every handler had to be typed by hand to mirror the generated query shape:

// app/[slug]/page.tsx
import { createClient } from "@&#8203;sanity/client";
import { createImageUrlBuilder } from "@&#8203;sanity/image-url";
import { PortableText } from "@&#8203;portabletext/react";
import { defineQuery } from "groq";

const client = createClient({
  projectId: "abc123",
  dataset: "production",
  useCdn: true,
  apiVersion: "2026-05-04",
});
const builder = createImageUrlBuilder(client);

export default async function Page({ slug }: { slug: string }) {
  const query = defineQuery(
    `*[_type == "post" && slug.current == $slug][0]{title,content}`
  );
  const data = await client.fetch(query, { slug });

  if (!data) return notFound();

  return (
    <article>
      <h1>{data.title}</h1>
      <PortableText
        components={{
          types: {
            image: ({
              value,
            }: {
              value: {
                asset?: {
                  _ref: string;
                  _type: "reference";
                  _weak?: boolean;
                };
                hotspot?: {
                  _type: "sanity.imageHotspot";
                  x?: number;
                  y?: number;
                  height?: number;
                  width?: number;
                };
                crop?: {
                  _type: "sanity.imageCrop";
                  top?: number;
                  bottom?: number;
                  left?: number;
                  right?: number;
                };
                alt?: string;
                _type: "image";
                _key: string;
              };
            }) => (
              <img src={builder.image(value).url()} alt={value.alt || ""} />
            ),
          },
        }}
        value={data.content}
      />
    </article>
  );
}
After: automatic inference

Now the same handler is fully typed straight from data.content:

// app/[slug]/page.tsx
import { createClient } from "@&#8203;sanity/client";
import { createImageUrlBuilder } from "@&#8203;sanity/image-url";
import { PortableText } from "@&#8203;portabletext/react";
import { defineQuery } from "groq";

const client = createClient({
  projectId: "abc123",
  dataset: "production",
  useCdn: true,
  apiVersion: "2026-05-04",
});
const builder = createImageUrlBuilder(client);

export default async function Page({ slug }: { slug: string }) {
  const query = defineQuery(
    `*[_type == "post" && slug.current == $slug][0]{title,content}`
  );
  const data = await client.fetch(query, { slug });

  if (!data) return notFound();

  return (
    <article>
      <h1>{data.title}</h1>
      <PortableText
        components={{
          types: {
            // value is fully typed from the query result, no annotation needed
            image: ({ value }) => (
              <img src={builder.image(value).url()} alt={value.alt || ""} />
            ),
          },
        }}
        value={data.content}
      />
    </article>
  );
}
InferComponents: hoisting components without losing inference

Move the components map out of JSX and keep the same inferred handler types:

// app/[slug]/page.tsx
import { createClient } from "@&#8203;sanity/client";
import { createImageUrlBuilder } from "@&#8203;sanity/image-url";
import { PortableText, type InferComponents } from "@&#8203;portabletext/react";
import { defineQuery } from "groq";

const client = createClient({
  projectId: "abc123",
  dataset: "production",
  useCdn: true,
  apiVersion: "2026-05-04",
});
const builder = createImageUrlBuilder(client);

export default async function Page({ slug }: { slug: string }) {
  const query = defineQuery(
    `*[_type == "post" && slug.current == $slug][0]{title,content}`
  );
  const data = await client.fetch(query, { slug });

  if (!data) return notFound();

  const components = {
    types: {
      image: ({ value }) => (
        <img src={builder.image(value).url()} alt={value.alt || ""} />
      ),
    },
  } satisfies InferComponents<typeof data.content>;

  return (
    <article>
      <h1>{data.title}</h1>
      <PortableText components={components} value={data.content} />
    </article>
  );
}
InferStrictComponents + InferValue: a strict, re-usable wrapper

InferValue<SanityQueries[keyof SanityQueries]> collects every Portable Text item shape from every registered TypeGen query into an array value type, and InferStrictComponents requires a handler for each of them. Together they're perfect for a single CustomPortableText you reuse across the app:

// app/[slug]/page.tsx
import { createClient, type SanityQueries } from "@&#8203;sanity/client";
import { createImageUrlBuilder } from "@&#8203;sanity/image-url";
import {
  PortableText,
  type InferStrictComponents,
  type InferValue,
} from "@&#8203;portabletext/react";
import { defineQuery } from "groq";

const client = createClient({
  projectId: "abc123",
  dataset: "production",
  useCdn: true,
  apiVersion: "2026-05-04",
});
const builder = createImageUrlBuilder(client);

// Array value type for every Portable Text item shape across all registered queries.
type PortableTextValue = InferValue<SanityQueries[keyof SanityQueries]>;

function CustomPortableText({ value }: { value: PortableTextValue }) {
  const components = {
    types: {
      image: ({ value }) => (
        <img src={builder.image(value).url()} alt={value.alt || ""} />
      ),
    },
  } satisfies InferStrictComponents<PortableTextValue>;
  //   ^ TypeScript errors when the schema gains a custom type, mark, or list
  //     style without a matching handler defined here

  return <PortableText components={components} value={value} />;
}

export default async function Page({ slug }: { slug: string }) {
  const query = defineQuery(
    `*[_type == "post" && slug.current == $slug][0]{title,content}`
  );
  const data = await client.fetch(query, { slug });

  if (!data) return notFound();

  return (
    <article>
      <h1>{data.title}</h1>
      {Array.isArray(data.content) && (
        <CustomPortableText value={data.content} />
      )}
    </article>
  );
}

v6.1.0

Compare Source

Minor Changes
sanity-io/plugins (@​sanity/assist)

v6.0.5

Compare Source

Patch Changes
sanity-io/visual-editing (@​sanity/preview-url-secret)

v4.0.6

Patch Changes
sanity-io/sanity (@​sanity/vision)

v5.24.0

Compare Source

Sanity Studio v5.24.0

This release includes various improvements and bug fixes.

For the complete changelog with all details, please visit:
www.sanity.io/changelog/studio-NS4yMy4w

Install or upgrade Sanity Studio

To upgrade to this version, run:

npm install sanity@latest

To initiate a new Sanity Studio project or learn more about upgrading, please refer to our comprehensive guide on Installing and Upgrading Sanity Studio.

📓 Full changelog

Author Message Commit
@​jordanl17 feat(core): make document action keys extensible via declaration merging (#​12768) eebdb17
@​bjoerge chore: replace pnpx with pnpm and add pkg-pr-new dependency (#​12783) 3d66c1f
@​bjoerge chore(turbo): remove unused env var (#​12781) f8111fc
@​bjoerge chore(ci): use pnpm whoami instead of npm whoami (#​12780) 2308d14
@​RitaDias test: add tests for createCallbackResolver (#​12779) 5625f37
squiggler-app[bot] fix(deps): update dependency @​sanity/cli to ^6.5.0 (#​12778) f3d306c
@​bjoerge fix: restore workspace hidden property (#​12775) 8f4e6b0
@​pedrobonamin fix(core): add version into documentEvents observable (#​12772) b511ef9
@​bjoerge chore(ci): switch to package build for lefthook (#​12767) 838e355
@​bjoerge chore: remove pre-commit husky hook (#​12766) 752aaf6
@​bjoerge chore: replace husky + lint staged with lefthook (#​12755) fcbdbdb
@​bjoerge chore: upgrade pnpm to 11.0.0 (#​12759) 50a185b
@​bjoerge chore(ci): drop node 20 from test matrix (#​12760) 8bc9911
squiggler-app[bot] chore(deps): update dependency @​tanstack/react-virtual to ^3.13.24 (#​12657) c4954c5
@​jordanl17 chore: adding telemetry to track when feedback dialog is opened and closed (#​12749) 6b16652
@​pedrobonamin fix(core): reset calendar focused date when setting to current time (#​12753) ff8a7d4
@​pedrobonamin chore(core): cleanup decision parameters schema (#​12751) aa8980b

v5.23.0

Compare Source

Features
sanity-io/sanity (sanity)

v5.24.0

Compare Source

Features
  • core: make document action keys extensible via declaration merging (#​12768) (eebdb17)
Bug Fixes

v5.23.0

Compare Source

Features
Bug Fixes
  • core: show json diffs for missing fields, skip _system field (#​12744) (57ebcca)
  • core: throw on missing projectId/dataset in getOperationStoreKey (#​12609) (583bcce)
  • diff: deduplicate repeated inline diff segments in Portable Text (#​12675) (26c140f)
  • feedback: associate labels with HTML form fields (#​12746) (d08b8ee)
  • form: maintain select button position with disableNew on image fields (#​12683) (91ebac8)
  • form: prevent scroll jump when opening field overflow menu (#​12629) (1ce6320)
  • issue when reverting to revisions in live edits (#​12729) (e0c829f)
  • releases: add empty state for cardinality-one releases with no documents (#​12687) (379906f)
  • releases: improve activity panel UX consistency (#​12686) (5b9cd5d)
  • remove underline from openInNewTabIcon menu item for refs (#​12724) (eb3ca24)
  • studio: hide user menu on mobile in dashboard mode (#​12684) (e51fee8)

Configuration

📅 Schedule: (in timezone Europe/Oslo)

  • Branch creation
    • "before 6am on Saturday"
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate using a preset from Obos. View repository job log here

@renovate renovate Bot requested a review from a team as a code owner March 6, 2026 23:07
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 6, 2026

⚠️ No Changeset found

Latest commit: 2e9f56b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@renovate renovate Bot force-pushed the renovate/sanity-packages branch from adfd401 to c5149e6 Compare March 10, 2026 07:05
@renovate renovate Bot changed the title fix(deps): update dependency @sanity/code-input to v7.0.11 fix(deps): update sanity packages Mar 10, 2026
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from c5149e6 to 84b322c Compare March 10, 2026 15:10
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 84b322c to bc56acf Compare March 10, 2026 19:38
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from bc56acf to 3851f83 Compare March 12, 2026 23:12
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 3851f83 to 906c236 Compare March 13, 2026 13:15
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 906c236 to 2481751 Compare March 14, 2026 17:01
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 2481751 to 8168c67 Compare March 17, 2026 18:46
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 8168c67 to 74538b2 Compare March 17, 2026 22:17
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 74538b2 to f9abac0 Compare March 18, 2026 14:56
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from f9abac0 to 4006543 Compare March 19, 2026 14:59
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 4006543 to 79c2ad0 Compare March 20, 2026 14:16
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 79c2ad0 to 030405d Compare March 20, 2026 18:50
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from a5215f8 to 3944c10 Compare April 8, 2026 15:53
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 3944c10 to 3d59ee7 Compare April 8, 2026 22:19
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 3d59ee7 to a639fcf Compare April 13, 2026 12:47
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from a639fcf to 6dae3a0 Compare April 13, 2026 13:00
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 6dae3a0 to c4d744d Compare April 13, 2026 13:26
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from c4d744d to 7325d12 Compare April 13, 2026 13:37
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 7325d12 to 810c79f Compare April 14, 2026 07:17
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 810c79f to d971cb2 Compare April 16, 2026 12:53
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from d971cb2 to 565865b Compare April 17, 2026 07:23
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 565865b to 33c1829 Compare April 17, 2026 09:47
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 33c1829 to a2946dd Compare April 17, 2026 13:25
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from a2946dd to 6897a27 Compare April 20, 2026 13:02
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 6897a27 to 958bdc9 Compare April 22, 2026 11:03
@renovate renovate Bot force-pushed the renovate/sanity-packages branch from 958bdc9 to 2db465d Compare April 24, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant