Comments (5)
I forked your repo and tried without the revalidation time and a revalidatePath
call inside the form action. It seems to work now (or are you expecting different results?). Note that when you refresh the page you might see old numbers because the ISR is revalidating the full router cache in the background. I guess that could be avoided with dynamic=force-dynamic
but than you loose the benefit of a fast cached response.
Commit: luismeyer/rappelscanner@1c30b1c
Preview: https://rappelscanner-git-feat-kv-luimey.vercel.app/?vercelToolbarCode=QCiZmInmjrleAx6
from storage.
hey @thomaslenaour, could you give some more context on from where you are calling the server action?
I just tried this based on the kv-redis-starter-example and it works just fine: https://kv-redis-starter-lime-rho.vercel.app. I did not set
revalidate=60
to opt into ISR though.
Hey @luismeyer, thanks for your response. In fact, here's the implementation I'm working on for a mini project: https://github.com/thomaslenaour/rappelscanner/blob/56402b2571c133f1aa89b708943c12da6ff344e3/app/_actions/product.ts#L52. Indeed, I've already tried playing with the Vercel example and the counter, and it works perfectly.
I feel like I've implemented it correctly, based on the example you mentioned, but I think I might be missing something because I can't get it to work in my project.
The Server Action is called upon form submission, as soon as you click on a "Search" submit button.
- Preview link: https://rappelscanner-git-feat-kv-thomaslenaour.vercel.app
- Repository link on the
feat/kv
branch: https://github.com/thomaslenaour/rappelscanner/tree/feat/kv
from storage.
hey @thomaslenaour,
could you give some more context on from where you are calling the server action?
I just tried this based on the kv-redis-starter-example and it works just fine: https://kv-redis-starter-lime-rho.vercel.app. I did not set revalidate=60
to opt into ISR though.
from storage.
Incredible! It seems to be working now. I was convinced that I had already tried it with revalidatePath
, but it still wasn't working.
Now, it works fine locally (with dockerized Redis) and also works in the Preview environment.
Thank you for your time and for your assistance @luismeyer!
That being said, in an attempt to understand things a bit better: why didn't the change of value occur in my initial code? Apparently, we just added revalidatePath
and removed the revalidation time. But that shouldn't have an impact on the incrementation of the scans
value, right?
from storage.
Glad I could help :)
I think beforehand you were running into the data cache. @vercel/kv
is doing fetch
requests to the upstash API and as stated in the the docs all fetch
requests are cached by default. revalidatePath
is purging the data cache and therefor when you call the action again the increment really happens.
I didn't try it but I think you could even keep the revalidate=60
in you page segment config.
from storage.
Related Issues (20)
- Add the ability to get the latest updatedAt first in the https://vercel.com/docs/storage/vercel-blob/using-blob-sdk#list method HOT 2
- Cannot delete blob database HOT 2
- Is there a way to change timezone for a session HOT 2
- Vercel Blob: Access denied, please provide a valid token for this resource HOT 15
- Progress rate of upload to Blob HOT 2
- Support for Signed URLs in Blob HOT 2
- Getting a broken image file from Blob storage HOT 2
- How to get the url by pathname? HOT 4
- Kysely Migrations fail because VercelPostgresDialect fails to report that VercelPostgres does not support transactions HOT 2
- Cannot use @vercel/blob in Edge runtime HOT 4
- Intermittent Request Failures with Vercel Postgres and Next.js HOT 6
- Vercel KV Request vs Storage Limit
- insert query are cached HOT 5
- @vercel/postgres: Extended constant is not working HOT 5
- [vercel/blob] file should use the true mime type when uploading the file HOT 3
- Vercel KV not reachable HOT 2
- @vercel/postgres parameters bind error HOT 1
- Vercel Postgres Polling & Revalidation on Focus HOT 5
- X-Frame-Options set to DENY prevents embedding PDF blob in object, embed or iframe HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from storage.