-
-
Notifications
You must be signed in to change notification settings - Fork 631
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(query): fully cacheable api #1752
Conversation
β Deploy Preview for nuxt-content ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Merging to test on edge |
@@ -37,7 +37,7 @@ export const createQueryFetch = <T = ParsedContent>(path?: string) => async (que | |||
|
|||
const params = query.params() | |||
|
|||
const apiPath = withContentBase(process.dev ? '/query' : `/query/${hash(params)}.${content.integrity}.json`) | |||
const apiPath = withContentBase(`/query/${process.dev ? '_' : `${hash(params)}.${content.integrity}`}/${encodeQueryParams(params)}.json`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Important note: This is potentially a breaking change as Nitro v1 limits whole URL length to 250 and by this change, we cause to skip such routes when prerendering.
https://github.com/unjs/nitro/blob/cbcd0681d37839f93fc7f3f106d34e3f01d2ac84/src/prerender.ts#L83
This change could be behind an experimental flag until the release of Nuxt 3.1 and Nitro 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, this change causes slight performance overhead of long URLs which is mainly needed for hybrid/server mode. When _generate: true
flag exists, we can safe assume deployment is full-static and omit last segment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So what you are suggesting is that we should switch between these methods based on nuxt.options._generate
boolean.
Pass this option to the runtimeconfig to delect whether its generated or not and change the API fetch.
Right?
@pi0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I don't like to create complicated behavior for us to describe and for users to understand.
So I'll go with experimental flag and disable this feature by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should work yes. We also need to have it as an experimental opt-in flag like content.experimental.fullPath
since as mentioned above, this feature, needs to be coupled with nitro v2 fix for long path segments support.
π Linked issue
β Type of change
π Description
π Checklist