-
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
Gatsby/Wordpress returning null on images after unpublishing #13104
Comments
I'm gonna need to check this out to see if I can reproduce it, it does seem very weird |
Seems like I get same effect with minimal repro |
Thanks for checking it out, I think it may be the thing listed here, doing what it said fixed the issue: https://www.gatsbyjs.org/packages/gatsby-source-wordpress/#graphql-error---unknown-field-localfile-on-type-image-field If that definitely is the case, is there maybe a fix the gatsby plugin can implement to fix it, or is something only fixable on the wordpress side? If so, I wonder if a wordpress plugin could be made to automatically do this. |
Yes, this is also one of the ways to workaround this. This happens because when you unpublish post that reference images - those images get "unpublished" too (and therefore removed from data store, but cache is not getting updated about and it tries to use non-existent nodes). I just opened Pull Request with change that fixes it ( #13140 ) |
Cool! I will test your PR if you'd like, not sure how to install your PR though (the mono repo has me a bit confused on how to do that). I had thought it couldn't be solved like this because I entirely nuked |
Fixed and published in [email protected] thanks to @pieh 🎉 |
This is really weird. We can't solve fact that wordpress "hides" image from being listed in image list response when you unpublish post (unless you remove |
I guess this can happen when you upload image to one post, unpublish that and then try to use same image in another post - at that point there is nothing we can do to fix it. Maybe there is some wordpress plugin that automatically could remove |
Description
I'm using: Gatsby, Wordpress, and gatsby-source-wordpress, and ACF on Wordpress for my custom data.
The issue I'm encountering is this: when a post is unpublished (from being published to a draft), and then re-published, the images (or almost all of them) become
null
.Example GraphQL being used:
In the instance of this GraphQL field, the issue I'm having is that
localFile
will benull
. Thetitle
in that query comes back fine, however.Furthermore, it also seems that the wordpress API response is correct. It seems highly possible its a bug in
gatsby-source-wordpress
, caching related?Help or advice would be much appreciated.
Other notes:
Image URL
(changing it has no effect on the issue)Steps to reproduce
Clear steps describing how to reproduce the issue. Please please please link to a demo project if possible, this makes your issue much easier to diagnose (seriously).
Expected result
What should happen?
Actual result
What happened.
Environment
System:
OS: Windows 10
CPU: (16) x64 AMD Ryzen 7 2700 Eight-Core Processor
Binaries:
Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
gatsby: ^2.1.0 => 2.2.6
gatsby-image: ^2.0.20 => 2.0.25
gatsby-plugin-manifest: ^2.0.9 => 2.0.12
gatsby-plugin-netlify-cache: ^1.1.0 => 1.1.0
gatsby-plugin-offline: ^2.0.16 => 2.0.20
gatsby-plugin-react-helmet: ^3.0.2 => 3.0.5
gatsby-plugin-react-svg: ^2.0.0 => 2.0.0
gatsby-plugin-sharp: ^2.0.14 => 2.0.16
gatsby-plugin-sitemap: ^2.0.11 => 2.0.11
gatsby-plugin-styled-components: ^3.0.4 => 3.0.4
gatsby-source-filesystem: ^2.0.8 => 2.0.12
gatsby-source-wordpress: ^3.0.25 => 3.0.25
gatsby-transformer-sharp: ^2.1.8 => 2.1.9
The text was updated successfully, but these errors were encountered: