shahradelahi / next-extra

âš¡ Enhance Next.js Beyond Limits
https://www.npmjs.com/package/next-extra
MIT License
120 stars 1 forks source link

[Question]: Reliability of the APIs in use #24

Closed typeofweb closed 5 days ago

typeofweb commented 2 weeks ago

First of all, let me tell you I admire the effort you've put into digging through Next.js internals and putting next-extra together. Kudos! 🙇

The libraries make use of staticGenerationAsyncStorage and requestAsyncStorage. Both are undocumented by the Next.js team and imported from paths that seem to be for internal use only.

Could you tell me your take on their reliability/stability? Any insights you can give me would be useful. Thanks!

shahradelahi commented 2 weeks ago

Hey @typeofweb, Thanks, I appreciate your support!

For the stability, since the majority of APIs that are exposed from the package use these storages, and I made read-only access to them, it makes it stable enough.

For the reliability, NextJs is nearly based on these storages for building requests and end responses for everything. If they want to make changes to it, it's going to be a major level release, which makes the incoming changes predictable.

These APIs are not documented for obvious reasons. I am not a Vercel insider nor in the NextJs developer team, but I highly recommend you read the NextJs source code itself to know where and how these storages are being used.

Here are some APIs that everybody uses and in underlying code, the staticGenerationAsyncStorage and requestAsyncStorage are being used.

import { headers, cookies } from 'next/headers'; 
import { redirect, permanentRedirect } from 'next/navigation'; 
shahradelahi commented 2 weeks ago

For now, I only made for support for Next 14, and at current state this package is NOT working in Next 15.

Neodark7 commented 2 weeks ago

Hi @shahradelahi ! what do you mean by it's NOT going to work in Next 15 ? you don't plan to support Next 15 ?

shahradelahi commented 2 weeks ago

Hi @Neodark7,

I'll make support for both Next 14 and Next 15, but the Next 15 is not stable yet. What I said before was for those who are using the canary version of Next 15.