DennisSnijder / payload-workflow

A workflow plugin for Payload CMS
https://github.com/DennisSnijder/payload-workflow
69 stars 2 forks source link

Admin components are being overridden by the plugin's config #6

Closed jacobsfletch closed 1 year ago

jacobsfletch commented 1 year ago

This line adds a custom List view to the collection, but does not spread the user's admin.components config back in: https://github.com/DennisSnijder/payload-workflow/blob/main/src/index.ts#L57. This means that when using this plugin, you cannot bring your own custom components with it. It's a simple fix:

// Collection.ts
{
  // ...
  admin: {
    // ...
    components: {
      ...collection?.admin?.components || {}, // THIS LINE FIXES IT
      views: {
        ...collection?.admin?.components?.views || {},
        List: WorkflowView(collectionPluginConfig)
      }
    }
  }
}
DennisSnijder commented 1 year ago

Hi @jacobsfletch !

Thanks for reporting this! good catch! I'll patch this ASAP!