Does it work with plugin based on graphql ?
muscaiu opened this issue · 1 comments
muscaiu commented
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](https://private-user-images.githubusercontent.com/11426309/277024410-40d0c834-64ef-438d-87e6-370b289c39de.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI4OTI0NzQsIm5iZiI6MTcyMjg5MjE3NCwicGF0aCI6Ii8xMTQyNjMwOS8yNzcwMjQ0MTAtNDBkMGM4MzQtNjRlZi00MzhkLTg3ZTYtMzcwYjI4OWMzOWRlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA1VDIxMDkzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVmYzc5NDlmZWM0ZjczODRmMzkzYTc1NjdkYTE0ZjhhMzc4ZDg2MzIyM2RmZTE2MTE0ZjZkNGFjZjk1YWQyYTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.c8Xeu3wDCHN20YdCZ49-uucNfzPvZi3mStXF-AMKRBg)
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
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.