Closed (fixed)
Project:
Gatsby Integration
Version:
2.0.0-beta2
Component:
User interface
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
3 Feb 2022 at 14:14 UTC
Updated:
17 Mar 2022 at 18:24 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
apmsooner commentedPossible related issue noted here regarding preview button functionality with --2 being added to id of preview button: https://drupal.slack.com/archives/CDQC1MDU6/p1643850389402169
This code would fail:
$("#edit-gatsby-preview").on("click", function (e) {Possibly related to: https://www.drupal.org/project/drupal/issues/3254328
Comment #3
scottalan commented@ampsooner The issue you referenced only relates to the "Gatsby Preview Button" functionality. The preview button can be added to the node form to help content editors get to the preview url.
This is unrelated to this issue in which the preview server is never actually being triggered for a refresh.
Comment #4
scottalan commentedI'm doing some debug this morning and gatsbyUpdate() is never called. I grepped the module to confirm and in fact nothing calls this method. If I'm not mistaken, without a call to this method it never calls triggerRefresh(). Thoughts?
I have to be missing something...right? How does the module trigger a refresh without a call to these methods? I guess I expected to see something like this from 1.0-rc6 https://git.drupalcode.org/project/gatsby/-/blob/8.x-1.0-rc6/gatsby.modu...
On
hook_entity_{insert,update}()in 1.0-rc6 the data is prepared (gatsbyPrepareData()), then via a shutdown function gatsbyUpdate() is called and then, triggerRefresh().Yes, I'm linking to 1.0-rc6 but the same should apply to all methods in 2.0.0-beta2.
edit: Looks like the "refresh" should occur here https://git.drupalcode.org/project/gatsby/-/blob/2.0.0-beta2/src/Control... but guessing this is only if fastBuilds is enabled? Since I can't get gatsby develop to complete with fastBuilds enabled maybe that why I'm never seeing a refresh.
Comment #5
damienmckennaComment #6
damienmckennaDoes this solve the problem?
Comment #7
damienmckennaThe data submission / trigger has two parts.
Comment #8
damienmckennaThe fastbuilds sync path had been changed by accident.
Comment #9
damienmckennaComment #11
damienmckennaI've committed #8, please test out the dev version so we can see if there's anything else missing. Thank you.
Comment #12
matt.hood commentedI am still running into issues here, with the patches applied Gatsby now recognizes what updates are made and there are no more preview build errors. However the data in the previews, as well as data on the site are not being updated during fastbuilds. Full builds have to be run for site updates to be seen and previews are not being updated at all for some reason.
Comment #13
damienmckennaComment #14
damienmckennaVia the logging I'm adding in #3263887: Add logging for requests to the fastbuild sync endpoint I've identified that Gatsby requests entities modified since a certain millisecond timestamp, whereas Drupal only uses the regular timestamp that works from the seconds.
Comment #15
damienmckennaThe milliseconds problem related to using a custom branch of gatsby-plugin-drupal that was very out of date.
It now says:
Comment #16
damienmckennaMore testing. On my Gatsby project I had added gatsby-source-drupal ^4.0.0, but that's an old release that went with Gatsby 3; the latest that works with Gatsby 4 is 5.8.0.
I have it working to the point that a Fastbuilds request comes in and a structure like the following is returned for an unpublished node:
Gatsby Cloud then says:
Comment #17
damienmckennaSo the problem appears to be the "attributes" structure that should be a nested array instead of whatever mucked up structure is coming out.
Comment #18
damienmckennaShould we use JSON_FORCE_OBJECT in the json_encode() call?
Comment #19
damienmckennaThis appears to have been fixed via other issues, if you spot further problems please open new issues and we'll work through them. Thank you.