Problem/Motivation
Gatsby Cloud (and potentially other preview providers) don't always need the /__refresh part of the URL. This module automatically assumes this is needed for preview URLs. You can see this here:
https://git.drupalcode.org/project/gatsby/-/blob/8.x-1.x/src/GatsbyPrevi... and https://git.drupalcode.org/project/gatsby/-/blob/8.x-1.x/modules/gatsby_...
This used to work in Gatsby Cloud but it was an undocumented approach that now appears to be unsupported.
Steps to reproduce
Try to get preview working in Gatsby Cloud.
Proposed resolution
- Remove the /__refresh part of the URL for preview builds (in the areas of code linked above)
- Update the documentation on the preview webhook field to be clear that the user may now need to add this
- This could technically be a breaking change, so it should probably automatically add /__refresh in an update hook so most sites will continue to work after the update
Issue fork gatsby-3204395
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
AJV009Cool, even I noticed this! My site did break once it tried to call '__refresh' I thought it was because of my incomplete gatsby setup[ and maybe it already supported this '__redi....', so its a bug? would love to get it fixed asap!
Comment #3
larowlanBecause the code uses a public static (for now) this should be easy to test.
Comment #4
codekarate CreditAttribution: codekarate commentedComment #7
larowlanPushed test and coding standards fixes, added the missing schema and default value.
Made the support for multiple values with CSV explicit.
Added an update path.
Comment #8
larowlanComment #10
larowlanGot the Drupal CI notification that this went in, but there's a PHPCS issue.
Fixed it and pushed that commit along with a config file.
For running locally, you can use
/path/to/drupalroot/vendor/bin/phpcs .
from inside the gatsby module folder./path/to/drupalroot/vendor/bin/phpcbf .
will fix things that can be auto-fixed.Comment #11
codekarate CreditAttribution: codekarate at Gatsby commentedThanks for the quick fix @larowlan!
This is working for me so I'm marking it completed.