#Cache revalidateTag not working

1 messages · Page 1 of 1 (latest)

tropic depot
#

I'm using uploadThing's api (related in a second) to upload files from the client to the uploadthing website. My webapp is the middle guy where I send a authentication/upload token to the client if they are allowed to upload the file.
The problem comes up when I want to change the icon that the user just uploaded to on the resource they are editting, the cache doesn't revalidate, no matter what I do, the only thing I can do is restart the server and the icon updates, or removing the cache feature.
I've tripple checked and I think this has to be a glitch with caching. Checkout my github here, the main culprit is this function updateResource, and the file icon router
This is where we call the projectUpdate function when a file uploaded: https://github.com/Minecentral-Official/Minecentral-Dashboard/blob/main/src/features/resources/uploadthing/file-route-icon.resource.ts#L29
and here is where the cache is revalidated: https://github.com/Minecentral-Official/Minecentral-Dashboard/blob/main/src/features/resources/mutations/update.project.ts#L9
This works only when I do something like a server action, or I do a fetch request using function that has this revalidateTag.
Any help would be amazing, voice chat would be great too because this feature is super imbedded into my project, and I need caching to release this thing

GitHub

Contribute to Minecentral-Official/Minecentral-Dashboard development by creating an account on GitHub.

GitHub

Contribute to Minecentral-Official/Minecentral-Dashboard development by creating an account on GitHub.

vestal isleBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

left palm
#

What I usually do, is create /api/revalidate endpoint, which does the revalidation and then fetch it from my crons etc. Not the prettiest and you have to worry about protecting it, but it works.

tropic depot
tropic depot
#

well, i caved, and I went with this solution, it aint pretty but it's protected against any maliciousness.
Thank you @left palm

left palm
#

Believe me, I was looking for purely programmatic solution, but never found any. It was some time ago, so there might be some known workaround, but if there is, it's not easy to find.