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

Default value on array of maps properties #599

Open
nkulic opened this issue Dec 6, 2023 · 0 comments
Open

Default value on array of maps properties #599

nkulic opened this issue Dec 6, 2023 · 0 comments

Comments

@nkulic
Copy link

nkulic commented Dec 6, 2023

What is the current behavior?

When using enumValues in a map property which is inside array (of) property, default enum value is not set.

What is the expected behavior?

Default enum value should be set.

Reproduction steps

I have created a repo with starter template and configured collection for reproduction of this issue:

Or manually create project with firecms template and modify collection config:

  1. Use starter template to create fireCMS project:
yarn create firecms-app
or
npx create-firecms-app
  1. Set firebaseConfig to valid firebase project
  2. Modify collection:
export const showcaseCollection = buildCollection({
  path: "showcase",
  customId: false,
  icon: "ShowChart",
  name: "Showcase",
  hideIdFromForm: true,
  properties: {
    featuredProducts: buildProperty({
      dataType: "array",
      name: "Featured products",
      of: {
        name: "Featured product",
        dataType: "map",
        properties: {
          size: buildProperty({
            dataType: "string",
            name: "Size",
            defaultValue: "smallVertical",
            enumValues: {
              largeVertical: { id: "largeVertical", label: "Large vertical" },
              smallVertical: { id: "smallVertical", label: "Small vertical" },
            },
          }),
          title: {
            name: "Product",
            dataType: "string",
          },
        },
      },
    }),
  },
});

Package versions used

  • "react": "^18.2.0"
  • "react-dom": "^18.2.0"
  • "firecms": "^2.0.0"
@fgatti675 fgatti675 changed the title Default enum value not set Default value on array of maps properties Dec 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant