blitz
blitz copied to clipboard
Allow using RouteUrlObject as redirect.destination in getStaticProps and getServerSideProps
Closes: https://github.com/blitz-js/blitz/issues/3697
What was done
- Added an example with getServerSideProps and redirect to one of the sample apps
- Added new types: BlitzGSSPResult and BlitzGSPResult. They are Blitz equivalent of Next's GetServerSidePropsResult and GetStaticPropsResult, with the only difference being that
redirect.destinationaccepts both string and RouteUrlObject (it's just string in Next types). - Used these types in the BlitzGSSPHandler and BlitzGSPHanlder
- Added
normalizeRedirectValuesfunction which Converts Blitz's getServerSideProps result and getStaticProps result to a NextJS compatible format, ie Blitz accepts string | RouteUrlObject as redirect.destination — this function converts it to a string. - Used the normalizeRedirectValues in the gSP and gSSP handlers.
🦋 Changeset detected
Latest commit: 79ec9139714feee8b3232bbbb10ed68e45080281
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 7 packages
| Name | Type |
|---|---|
| @blitzjs/next | Patch |
| @blitzjs/auth | Patch |
| @blitzjs/rpc | Patch |
| @blitzjs/codemod | Patch |
| @blitzjs/config | Patch |
| @blitzjs/generator | Patch |
| blitz | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR