-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(gatsby-source-contentful): fix missing data with rich text fields #15084
fix(gatsby-source-contentful): fix missing data with rich text fields #15084
Conversation
Awesome @Khaledgarbaya! I'll pull this down and see if I'm able to fix any issues. Thanks for prioritizing this--it's been a sore spot for some users so super excited to get this fix in as soon as possible! |
Thanks for the fast help and response ! @DSchau and @Khaledgarbaya. Super pumped when this is fixed and let me know when I can test it or you need help / reproduction cases! |
I've published |
a6ce40e
to
2e24997
Compare
@Khaledgarbaya sorry - missed this! I’ll DM you on Twitter in 5. |
@Khaledgarbaya Your fix is working for me :) |
2e24997
to
a55a690
Compare
Hi @Khaledgarbaya, 2.1.2-rich-text-resolve.18 solves the hot reloading issue for me (thanks for that!), so I will wait for the merge. However, I would like to check about an issue with entries included on rich text that could be introduced with this fix. I am not sure if it exists before cause I was not able to see rich text data because the error. If I update an entry included on a rich text, the hot reload update the entry but does not update the json where it is included. Example: |
Hi @odorisioe, |
Hi @Khaledgarbaya I will try to create a video soon but these are the steps to reproduce the error Steps
# Get created page by id - include the rich text as json
query PageByIdQuery($id: String!) {
contentfulPage(id: { eq: $id }) {
id
content {
json
}
}
}
# Get video block by id (the one embedded on the rich text)
query VideoBlockByIdQuery($id: String!) {
contentfulVideoBlock(id: { eq: $id }) {
id
url
caption
}
}
ResultVideoBlockByIdQuery includes the updated values added on step 6. Do POST request to /__refresh do not regenerate the rich-text json. |
@Khaledgarbaya for sure. I'll do that today! |
Successfully published:
Install with npm i gatsby-source-contentful@rich-text-resolve |
…solving the references for us
1409cf9
to
135b32e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usage of Cf SDK looks 👍 to me! very excited this is being fixed :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks for picking this up
Thanks @phoebeschmidt & @Khaledgarbaya So lets continue for #24905 |
…e performance (#27244) * fix(gatsby-source-contentful): fixed id collision in contentful entries (#23514) * fix(gatsby-source-contentful): fixed id collision in contentful entries * fix(gatsby-source-contentful): properly resolve subsequent sync calls (#15084) * fix(gatsby-source-contentful): fixed id collision in contentful entries (#23514) * fix(gatsby-source-contentful): fixed id collision in contentful entries * improve logging and clean up code (#26238) * improve comment about contentful-resolve-response usage * test(unit): remove cross test data pollution * further improve loggin by replacing console.time with GatsbyReporter * improve code style * missing file * remove logging verbosity * adjust mocked reporter for tests to pass * remove unused deep-map dependency * fix: use content type id by default to create reference gql types (#26102) * temporary console.time calls for performance measurements * perf(gatsby-source-contentful): use a map and less loops to merge old and latest sync API response * log time Contentful API processing and GraphQL node creation * upgrade dependencies and use faster node 10 versions * remove duplicate logging * allow multiple Contentful sources fixes #26875 * refactor(imports): fix dependency structure and make sharp optional fixes #23904 * align tests to match new multi source cache pattern Co-authored-by: Matthew Miller <mnmiller1@me.com> Co-authored-by: Khaled Garbaya <khaled@contentful.com>
Description
This PRs is an attempt to fix missing data on content changes at contentful.
the gatsby-source-plugin is using the Contentful SDK which is calling the sync API behind the scene for the first sync the SDK will have all the data available to it so it can perform the link resolution however in the subsequent sync the API will return only the changed entries which is not enough data for the SDK to do the link resolution.
Solution
By saving the previous sync data and using it later to do link resolution we make sure that all links are resolved
Related Issues
TODO
Add testsexisting tests should do