GithubHelp home page GithubHelp logo

insert query are cached about storage HOT 5 CLOSED

smailio avatar smailio commented on June 1, 2024 1
insert query are cached

from storage.

Comments (5)

vvo avatar vvo commented on June 1, 2024 2

Correction: POST requests are being cached at the moment yep even in server actions. I wrongly linked request memoization (which is a different feature).

The suggestion from @luismeyer should work. And in a future Next.js release POST in server actions won't be cached anymore.

from storage.

Darkness-2 avatar Darkness-2 commented on June 1, 2024

Getting the same issue when trying out the Next.js learn tutorial. Making the same INSERT or UPDATE query twice results in only one query ever executing.

from storage.

smailio avatar smailio commented on June 1, 2024

When I delete the cache directory in next it works again so it's definitely that. Maybe I should post on next github ?

from storage.

luismeyer avatar luismeyer commented on June 1, 2024

hey @smailio,
this is expected, since all fetch requests on the server are cached by Next.js by default (docs)

Ways to fix this could be:

  • opt out of the data cache with unstable_noStore (docs)
  • call revalidatePath or revalidateTag to purge the cache manually (docs)

from storage.

vvo avatar vvo commented on June 1, 2024

@smailio @luismeyer From reading the docs, only GET methods are being cached in Next.js App Router ("Good to know" from https://nextjs.org/docs/app/building-your-application/caching#request-memoization).

And our database client uses POST (https://github.com/neondatabase/serverless/blob/947e5b107f3f3f9c9af1f769d3d7e63a49a43e96/export/httpQuery.ts#L162-L167). So something else is doing caching here, could it be some server action custom behavior?

from storage.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.