Code Monkey home page Code Monkey logo

Comments (6)

chungweileong94 avatar chungweileong94 commented on May 24, 2024 1

The issue is caused by the stricter use server check in the recent 14.1.2 update, it seems to me NextJS is performing syntax-level checking which might raise some false errors. It actually breaks my server action builder package.

Repro: https://github.com/chungweileong94/next-use-server-bug

from next.js.

bduff9 avatar bduff9 commented on May 24, 2024 1

Its worth noting that this currently breaks the example shown in the documentation around using React.cache currently: https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#fetching-data-on-the-server-with-third-party-libraries

from next.js.

ceIia avatar ceIia commented on May 24, 2024

yeah, i had to make sure i used the export async function(return somepromise) syntax, as export const = async () => { await ... } would not work

from next.js.

chungweileong94 avatar chungweileong94 commented on May 24, 2024

It seems like NextJS is doing action.constructor.name !== 'AsyncFunction' check, however, if the action is created via a library, it will get transpiled into Promise<...> instead of action.constructor.name !== 'AsyncFunction'. The only workaround now is to create a async function wrapper around, which is kinda annoying.

// Note: if it's from library code with `async` being transpiled to returning a promise,

from next.js.

shuding avatar shuding commented on May 24, 2024

This is a duplicate of #62860 - please give #62860 (comment) and #62821 a read. We'll keep everyone updated there.

Basically it does not make sense to use React.cache together with Server Actions and it will not cache anything.

from next.js.

github-actions avatar github-actions commented on May 24, 2024

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

from next.js.

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.