tatethurston / TwirpScript

A protobuf RPC framework for JavaScript and TypeScript
MIT License
142 stars 13 forks source link

Support for Nextjs 13 Fetch API #221

Closed ghost closed 1 year ago

ghost commented 1 year ago

In nextjs 13, static rendering, ISR and SSR is determined only by the arguments in fetch. Since we have no access to fetch API and it’s features this is impossible

import { GetHat } from ‘./generated.pb’

async function Component({id}) {
    const hat = await GetHat({ id }).config({
    next: {
         revalidate: 1000,
         tags: ['collection']
       },
    cache: “no-store”
    })

return (<p>{hat}</p>)
}

}
tatethurston commented 1 year ago

@frankwoodi did you checkout the rpcTransport option?

ghost commented 1 year ago

Thanks @tatethurston, I wrote a wrapper around it and it works fine