Skip to content

[bug]: CLI Registry universal items still removes 'use client' from tsx files #8432

@VeiaG

Description

@VeiaG

Describe the bug

I'm trying to open my registry for some useful files, but without framework detection & components.json
'use client' directive is removed from tsx , assuming rsc is false.

My registry.json

 {
      "name": "color-picker",
      "type": "registry:item",
      "title": "Color Picker",
      "description": "A customizable color picker field for PayloadCMS.",
      "files": [
        {
          "path": "registry/fields/color-picker/field.ts",
          "type": "registry:file",
          "target": "~/src/fields/color-picker/field.ts"
        },
         {
          "path": "registry/fields/color-picker/index.tsx",
          "type": "registry:file",
          "target": "~/src/fields/color-picker/index.tsx"
        },
         {
          "path": "registry/fields/color-picker/style.scss",
          "type": "registry:file",
          "target": "~/src/fields/color-picker/style.scss"
        },
         {
          "path": "registry/fields/color-picker/types.ts",
          "type": "registry:file",
          "target": "~/src/fields/color-picker/types.ts"
        }
      ]
    }

Going into URL manually i can see use client, but adding files from this registry removes it.

Affected component/components

CLI

How to reproduce

1.Try to add components from this registry - https://payload.veiag.dev/r/color-picker.json
2.index.tsx content saved without 'use client'

JSON:
Image
Saved file:

Image

Codesandbox/StackBlitz link

No response

Logs

System Info

Node v22.16.0
latest shadcn package

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions