-
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
Handle Deleting of Files Properly w/ GraphQL, etc #4351
Comments
Are you on the latest version of gatsby? I spent nearly a day on this very issue a few weeks ago :-) |
I believe I am unless it came out like a day ago. Will be awesome if that is it - one moment. |
Nope.. reinstalled gatsby completely and on version I will do that now though in case it will only handle from nwo on rathr than files I deleted previously. |
oof - just noticed tons of errors - yall need a |
Those errors are React errors... it's not necessarily something Gatsby is doing. I'll look at gatsby-advanced-starter and see if I can reproduce this really quick. |
We aim towards the cache being 100% accurate. A cache you have to clean all the time is useless. Would love it if you could help me figure out why this is happening so we can solve it! |
I just installed the starter and ran Can you double-check what version you're on? |
I'm upgrading packages now and then will test if I can make the cache invalid by deleting files. |
I updated to the package shown in the post above. The errors were react but they were a result of the query returning data about files that no longer exist. Removed cache manually now and going to try more, unfortunately my ISP appears to be on the fritz. |
I've replicated the bug — looking into why it's happening. |
Great! Also happens when I move them into different folders as well. Seems it just needs to run a new query on the overall file contents when certain things occur. |
The previous PR for this #4209 didn't actually quite work. It worked in that it did delete descendant nodes correctly but by handling it in the reducer, the rest of Gatsby wasn't alerted to the other nodes being deleted which meant that hot reloading of graphql query data wasn't working.
Just put up a PR which should fix this. I'm feeling a bit gun-shy given I thought I'd fixed this once or twice before 😅 But I improved the tests + manually tested this a bunch so I think I've wrapped my head around the problem and the solution is correct. Will merge and release once tests pass. |
Thanks for reporting the issue! And sorry for the frustration! |
Sweet! Thank you for working on this so quickly! It's a bit hard to work out the magic Gatsby does but overall everything is pretty well put together! It definitely manages the details very well! |
Sorry to say now deleting files crashes Gatsby
|
@bradennapier I'm not able to replicate that error, deleting a markdown file gives me output like:
Could you try out the Using remark example and see if you still get that unhandled rejection error? You'll need to upgrade it to use the latest version of Gatsby. |
Description
If you delete or rename markdown pages right now you can not get rid of them and errors pop up even if you restart
gatsby develop
. Only way to fix it appears to be to delete everything and start over (.cache
andpublic
folders).Perhaps cleaning the cache should be done in some way? It still thinks these posts exist many hours after they are completely removed.
I had assumed maybe there was a
gatsby clean
orgatsby purge
but I didn't see it so it would appear this would break forever for anyone that did't know they had to manually delete those folders on every change?Steps to reproduce
1. Make Markdown File in
gatsby-advanced-starter
but any should work as the gatsby node config doesnt re-run and/or runs in cache (dont know really with the magic that happens)2. Delete it
3.It still exists on reloads in the graphql database
...
I get these errors because it is thinking a bunch of files exist when I simply renamed or deleted them.
The text was updated successfully, but these errors were encountered: