strapi-plugin-preview-button icon indicating copy to clipboard operation
strapi-plugin-preview-button copied to clipboard

Does it work with plugin based on graphql ?

Open muscaiu opened this issue 1 year ago • 1 comments

I'm using the gatsby-source-strapi plugin to query the data in my Gatsby FE app.

This config makes the preview button show up in the Strapi CMS.

module.exports = ({ env }) => ({
  'preview-button': {
    config: {
      contentTypes: [
        {
          uid: 'api::game.game',
          draft: {
            url: 'http://strapiurl:1337/api/preview',
            query: {
              type: 'game',
              slug: '{slug}',
            },
          },
          published: {
            url: 'https://gatsbyurl/games/{slug}',
          },
        },
      ],
    },
  },
});
Screenshot 2023-10-20 at 21 34 43

If i change the title for ex and i click the Preview button i don't see the new title.

Is this how it's supposed to work or is this because i'm using the gatsby-source-strapi plugin?

muscaiu avatar Oct 20 '23 18:10 muscaiu

Hi @muscaiu Your config looks correct 👍🏻 I wouldn't expect gatsby-source-strapi to conflict with the preview button.

When you change the title are you saving the entry before clicking the preview button? The plugin won't use the current values in the frontend fields, it only uses the data stored in the database.

mattmilburn avatar Nov 04 '23 14:11 mattmilburn