mattmilburn / strapi-plugin-preview-button

A plugin for Strapi CMS that adds a preview button and live view button to the content manager edit view.
MIT License
106 stars 38 forks source link

Does it work with plugin based on graphql ? #114

Open muscaiu opened 1 year ago

muscaiu commented 1 year ago

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?

mattmilburn commented 1 year ago

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.