azzlack/sanity-plugin-tabs

Missing field title in modal

Closed this issue · 0 comments

Objects nested in an object with the tab input will loose their title when inside an array (modal).

Screenshots

See how the same schema produces different results with and without the tabs component.

Without

Note the title Inner Object 1

Screen Shot 2021-08-25 at 21 16 02

With

Inner Object 1 is missing in the UI

Screen Shot 2021-08-25 at 21 17 08

Schema

import Tabs from 'sanity-plugin-tabs';

export default {
  name: 'nested',
  type: 'document',
  fields: [
    {
      name: 'array',
      type: 'array',
      of: [
        {
          name: 'outerObject',
          type: 'object',
          fieldsets: [
            { name: 'main', title: 'Main Fieldset' },
            { name: 'aside', title: 'Aside Fieldset' }
          ],
          inputComponent: Tabs,
          fields: [
            {
              /*
              This object title will not be displayed
              when using the tab input.
              */
              name: 'innerObject1',
              type: 'object',
              fieldset: 'main',
              fields: [
                {
                  name: 'innerObject2',
                  type: 'object',
                  fields: [
                    {
                      name: 'innerObject2Child',
                      type: 'string'
                    }
                  ]
                },
                {
                  name: 'innerObject1Child',
                  type: 'string'
                }
              ]
            },
            {
              name: 'dummy',
              type: 'string',
              fieldset: 'aside'
            }
          ]
        }
      ]
    }
  ]
};

Packages

{
  "name": "sanity-bug",
  "private": true,
  "version": "1.0.0",
  "description": "",
  "main": "package.json",
  "author": "Niklas May",
  "license": "UNLICENSED",
  "scripts": {
    "start": "sanity start",
    "test": "sanity check"
  },
  "keywords": [
    "sanity"
  ],
  "dependencies": {
    "@sanity/base": "^2.15.1",
    "@sanity/components": "^2.14.0",
    "@sanity/core": "^2.15.0",
    "@sanity/default-layout": "^2.15.1",
    "@sanity/default-login": "^2.15.0",
    "@sanity/desk-tool": "^2.15.2",
    "@sanity/vision": "^2.15.0",
    "prop-types": "^15.6",
    "react": "^16.2",
    "react-dom": "^16.2",
    "sanity-plugin-tabs": "^2.0.1"
  },
  "devDependencies": {
    "babel-eslint": "^10.1.0",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-prettier": "^3.4.1",
    "eslint-plugin-react": "^7.24.0",
    "prettier": "^2.3.2"
  }
}