-
Notifications
You must be signed in to change notification settings - Fork 164
Open
Description
I would like to be able to opt-out of forced client-side session fetch that happens on each page load:
Line 100 in 0ff5cc7
addPlugin(resolver.resolve('./runtime/app/plugins/session.client')) |
nuxt-auth-utils/src/runtime/app/plugins/session.client.ts
Lines 6 to 8 in 0ff5cc7
if (!nuxtApp.payload.serverRendered) { | |
await useUserSession().fetch() | |
} |
I have two specific use cases in mind for avoiding the default plugin:
- I would like to optimize no-SSR data fetch as explained here Get rid of extra HTTP request with ssr: false #449 (if you decide that approach is too magicky to land in the core, at least allow this to be implemented with a user-land plugin).
- For some projects, I also would like to deliver non-JSON-serializable user data. For instance, I have a project involving e2e encryption, where the auth session brings WebCrypto keys (Uint8Array's). Most of the client-server communication is performed via tRPC and a custom serializer that passes binary data transparently, but specifically for the auth session I had to come up with ugly boilerplate and intermediary types. I would like to either fetch the session data with a custom tRPC endpoint, or perhaps combine this with (1) and deliver this with a custom Nuxt payload.
How I see it, it will be a simple option in nuxt.config.ts
:
export default defineNuxtConfig({
session: {
plugin: false // or injectPlugin: false
}
})
I can come up with a PR if you generally approve this.
samydoesit
Metadata
Metadata
Assignees
Labels
No labels