-
Notifications
You must be signed in to change notification settings - Fork 26.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into tt-violation-fix-styles
- Loading branch information
Showing
4 changed files
with
40 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,6 @@ | |
"next": "latest", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"zustand": "^3.5.4" | ||
"zustand": "^3.7.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import Page from '../components/page' | ||
import { initializeStore } from '../lib/store' | ||
|
||
export default function SSG() { | ||
return <Page /> | ||
} | ||
|
||
// If you build and start the app, the date returned here will have the same | ||
// value for all requests, as this method gets executed at build time. | ||
// You will not see this while in development mode though. | ||
export function getStaticProps() { | ||
// Note that in this case we're returning the state directly, without creating | ||
// the store first (like in /pages/ssr.js), this approach can be better and easier | ||
const zustandStore = initializeStore() | ||
return { | ||
props: { | ||
initialZustandState: { | ||
lastUpdate: Date.now(), | ||
light: false, | ||
}, | ||
// the "stringify and then parse again" piece is required as next.js | ||
// isn't able to serialize it to JSON properly | ||
initialZustandState: JSON.parse(JSON.stringify(zustandStore.getState())), | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters