Skip to content

Commit

Permalink
Merge pull request #1061 from o1-labs/next-ssr-guide
Browse files Browse the repository at this point in the history
Add server component cache disclaimer to tutorial 4
  • Loading branch information
hattyhattington17 authored Dec 5, 2024
2 parents 1126616 + 4c32f69 commit 3b56dac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/algolia-search.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#

name: Algolia-Search

on:
push:
branches:
Expand Down
6 changes: 6 additions & 0 deletions docs/zkapps/tutorials/04-zkapp-ui-with-react.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ async setActiveInstanceToDevnet() {
Depending on the network you are going to work with you might want to consider changing the GraphQL endpoint in the `setActiveInstanceToDevnet` function.
Mind the supported networks by `Auro Wallet` though.
:::info
In this example, the `o1js` code is included in a client component and executed on the client side using an effect after the page loads. If you're integrating `o1js` within a server component, be aware that Next.js's caching mechanism might cause `o1js` to return outdated data. To prevent this, you can disable caching by adding `export const revalidate = 0;` to your component. For more details, refer to the [Next.js caching documentation](https://nextjs.org/docs/app/building-your-application/caching#opting-out-2).
:::
### Add state
These `04-zkapp-browser-ui/ui/app/page.tsx` statements creates mutable state that you can reference in the UI. The state updates as the application runs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ This feature remains experimental, indicating that it is currently under active

- [Experimental Offchain Storage part 1](https://github.com/o1-labs/o1js/pull/1630)
- [Experimental Offchain Storage part 2](https://github.com/o1-labs/o1js/pull/1652)
- [An end-to-end example utilizing Offchain storage](https://github.com/o1-labs/o1js/blob/main/src/lib/mina/actions/offchain-contract.unit-test.ts)
- [An end-to-end example utilizing Offchain storage](https://github.com/o1-labs/o1js/blob/main/src/lib/mina/actions/offchain-contract-tests/ExampleContract.ts)

0 comments on commit 3b56dac

Please sign in to comment.