Skip to content

Pane header create button renders intent and params as DOM attributes while template permissions load #15035

Description

@okadriu

Describe the bug

In development, opening a document list whose pane header shows a single create button logs two styled-components warnings:

styled-components: it looks like an unknown prop "intent" is being sent through to the DOM, which will likely trigger a React console error. […]
styled-components: it looks like an unknown prop "params" is being sent through to the DOM, which will likely trigger a React console error. […]

On the first render the button is an anchor that carries both props as attributes:

<a data-testid="action-intent-button" role="link" aria-disabled="true" intent="create" params="[object Object]">

Once the template permissions resolve, it is replaced by the regular IntentLink (href="/intent/create/template=author;type=author/", no intent or params attribute), so the leak lasts only for the loading render.

The disabled branch of the core IntentButton spreads every prop into the anchor (IntentButton.tsx#L14-L15):

return props.disabled ? (
  <Button {...props} as="a" role="link" aria-disabled="true" />

PaneHeaderCreateButton passes the intent into it as spread props (#L123), and the button is disabled while useTemplatePermissions is still loading (const disabled = !permissions?.granted, #L112). This started with #14226, which replaced the structure-local IntentButton (it destructured intent before spreading the rest) with the core one.

To Reproduce

A Studio with nothing but the structure tool is enough:

// sanity.config.ts
import {defineConfig} from 'sanity'
import {structureTool} from 'sanity/structure'

export default defineConfig({
  projectId: '<projectId>',
  dataset: '<dataset>',
  plugins: [structureTool()],
  schema: {
    types: [{name: 'author', type: 'document', fields: [{name: 'name', type: 'string'}]}],
  },
})
  1. Install sanity@6.15.0, react@19.3.0, react-dom@19.3.0 and styled-components@6.5.3, then run sanity dev.
  2. Open /structure/author.
  3. See both warnings in the browser console.

With the same setup on sanity@6.9.2 the warnings do not appear. The code is unchanged in 6.16.0 and on main (6619338).

Expected behavior

No unknown-prop warnings: the disabled create button renders its anchor without the IntentLink-only props such as intent and params.

Which versions of Sanity are you using?

@sanity/cli (global)  8.12.0 (latest: 8.13.0)
sanity                6.15.0 (latest: 6.16.0)

What operating system are you using?

macOS 26.6.2, Chrome 154

Which versions of Node.js / npm are you running?

Node.js 24.20.0, pnpm 11.27.1

Additional context

Reproduced both in a Next.js 16.3 app with an embedded Studio (next-sanity 13.3.4) and in the standalone setup above.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions