mattmilburn/strapi-plugin-preview-button

Button not display for single-types

WebMamba opened this issue ยท 5 comments

Hey folks! I have the plugin installed here is my package.json :

"dependencies": {
"@strapi/plugin-i18n": "4.3.2",
"@strapi/plugin-users-permissions": "4.3.2",
"@strapi/strapi": "4.3.2",
"better-sqlite3": "7.4.6",
"dotenv": "^16.0.1",
"find-config": "^1.0.0",
"mysql": "^2.18.1",
"strapi-plugin-preview-button": "^0.3.5"
},

and I added the following configuration in ./config/plugins.js

module.exports = { 'preview-button': { config: { contentTypes: [ { uid: 'api::home-page.home-page' } ] } } }

But the button in never display. Do i miss something in the de docs ?

Hi @WebMamba I think you may still need to configure env vars for the plugin. You can read about it in the docs here.

In a future release, these env vars will become optional ๐Ÿ‘๐Ÿป

Let me know how this works out for you.

No I already configure my envs. Here is my .env file :

STRAPI_PREVIEW_DRAFT_URL=http://localhost:1337/api/preview
STRAPI_PREVIEW_PUBLISHED_URL=http://localhost:8000
STRAPI_PREVIEW_SECRET=12345

I am using strapi 4.3.2

It's actually working great with my collection content-type but still not working with my single type.

I dig in to your code and I find that, when you are in the single-type page :

const data = useSelector( state => state[ pluginId ].data );

here the data is empty.

Here is empty also :

But I can't figure out why is empty juste in single-type;

@WebMamba Okay I see the issue now. I actually thought this issue had been resolved before ๐Ÿค” Anyway, I will be working on a bug fix for this today ๐Ÿ‘๐Ÿป Thank you for raising this issue!

@WebMamba This should be resolved now in the latest version v0.3.6

Please let me know how this works out for you ๐Ÿ™‚

@mattmilburn thanks for your work! It's working great now! But I looked at your correction, that was a silly bug! Maybe you can do an issue to the strapi repo, it doesn't look like the expected behaviour. ๐Ÿค”