Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Studio list preview displays undefined when content imported via CLI #7769

Open
jschneider33 opened this issue Nov 6, 2024 · 0 comments
Open

Comments

@jschneider33
Copy link

jschneider33 commented Nov 6, 2024

Describe the bug

After bulk importing a number of documents with a list of objects, the preview name and image on each list item shows undefined instead of the name and image. When adding another item to the list manually, the name and image display as expected. Inspecting the schemas reveal that they are identical except the imported items have a _id field whereas the manual additions do not.

To Reproduce

Steps to reproduce the behavior:

  1. Create and deploy 2 schemas:
export const deviceType = defineType({
  name: 'author',
  title: 'Author',
  type: 'document',
  fields: [
    defineField({
      name: 'name',
      title: 'Name',
      type: 'string',
    }),
    defineField({
      name: 'books',
      title: 'Books',
      type: 'array',
      of: [
        {
          type: 'book',
        },
      ],
    }),
  ],
});

export const worksWithDevice = defineType({
  name: 'book',
  title: 'Book',
  type: 'object',
  fields: [
    defineField({
      name: 'name',
      title: 'Name',
      type: 'string',
    }),
    defineField({
      name: 'image',
      title: 'Cover',
      type: 'image',
  ],
});
  1. Create an NDJSON file as import using the CLI as explained here https://www.sanity.io/docs/importing-data
  2. Once the studio refreshes, the books and authors are populated, but every book shows: "Undefined" and no image appears
  3. Manually add another book and uploaded photo, this item correctly displays the name and photo.

Expected behavior

Regardless of upload process, the name and image preview should correctly display.

Screenshots
*multiple books were uploaded via cli, then "The Hobbit" was added manually after successful import.
Screenshot 2024-11-06 at 2 01 13 PM

Which versions of Sanity are you using?

@sanity/cli (global)  3.63.0 (up to date)
@sanity/types         3.63.0 (up to date)
@sanity/ui            2.8.19 (up to date)
@sanity/vision        3.59.1 (latest: 3.63.0)
sanity                3.63.0 (up to date)

What operating system are you using?

MacOS

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

10.7.0
v18.20.4

Additional context

@jordanl17 jordanl17 added SDK bug labels Nov 8, 2024 — with Linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants