mattmilburn/strapi-plugin-preview-button

TypeError with Strapi v.4.3.3 and v.4.3.4

bennyhoyer opened this issue · 2 comments

I got the following client error using the preview button plugin (0.3.6) with strapi v.4.3.3 or v.4.3.4:

TypeError: Cannot read properties of null (reading 'model')

The error occurs when I open a detail view for an entity of a collection type.

plugin config is:

'preview-button': {
    enabled: true,
    config: {
      contentTypes: [
        {
          uid: 'api::article.article',
          targetField: 'slug',
          draft: {
            query: {
              type: 'news',
            },
          },
        },
      ],
    },
 },

Downgrading strapi to 4.3.2. fixes this error, but is not a satisfactory solution in the long run.

Hi @BennyMoser I'm unable to reproduce this issue using Strapi v4.3.4 with the plugin v0.3.6. Your plugin config looks correct. Are you able to share your package.json and any other details about your setup?

This plugin does not reference model anywhere so I'm wondering if it is triggering the error through some mis-configuration.

Also try deleting the yarn.lock and node_modules and running yarn again. (just good to rule it out)

Hi Matt I'm quite familiar with node.js but deleting yarn.lock was the only thing i did'nt try.
And of course it fixes the error. I only deleted the node_modules directory a few times...

Thank you for helping me!