payloadcms / website-cms

The CMS behind payloadcms.com
152 stars 46 forks source link

link field's appearance select bug #19

Open zanami opened 1 year ago

zanami commented 1 year ago

I guess there's a small bug in fields/link.ts

    linkResult.fields.push({
      name: 'appearance',
      type: 'select',
      defaultValue: 'default',
      options: appearanceOptionsToUse,
      admin: {
        description: 'Choose how the link should be rendered.'
      }
    });

SelectInput throws "TypeError: undefined is not an object (evaluating 'matchingOption.label')" if 'default' is not in appearanceOptionsToUse around here probably.

There's a place in fields/hero.ts

    linkGroup({
      appearances: ["primary", "secondary"], // no "default" = TypeError
      overrides: {
        name: "buttons",
        label: "Buttons",
        maxRows: 2,
        admin: {
          condition: (_, { type }) => type === "home",
        },
      },
    }),
pcbal commented 1 year ago

Case Studies render path "affected" with /case_studies instead of /case-studies here due to some path character replacement when linking the case-study document with the said linkgroup buttons. The linked URL becomes http://localhost:3000/case_studies/the-case-study-page which ends up in a 404 page. The actual URL path should be http://localhost:3000/case-studies/the-case-study-page for this page to render. Maybe something related to the said issue.

jacobsfletch commented 1 year ago

Case Studies render path "affected" with /case_studies instead of /case-studies here due to some path character replacement when linking the case-study document with the said linkgroup buttons.

@pcbal I believe @PatrikKozak fixed this issue with https://github.com/payloadcms/website/commit/3df1353216450dc299bfea44d7b77a43fe7d7412 which might be different than described by @zanami