Skip to content

Commit

Permalink
Merge branch 'main' into chore/dev-store
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi committed Dec 23, 2024
2 parents 8aa1d88 + 36062fb commit 897e005
Show file tree
Hide file tree
Showing 37 changed files with 5,944 additions and 4,083 deletions.
2 changes: 2 additions & 0 deletions docs/extensions/query.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ Although they reference methods same query key (`'todos'`), the `onSuccess` inva

This will result in `todosAtom` showing stale data as it was not prompted to refetch.

⚠️ Note: When using **Typescript**, it is recommended to use a Map when passing the queryClient value to useHydrateAtoms. You can find a working example in the [Initializing State on Render docs](https://jotai.org/docs/guides/initialize-atom-on-render#using-typescript)

```jsx
import { Provider } from 'jotai/react'
import { useHydrateAtoms } from 'jotai/react/utils'
Expand Down
2 changes: 2 additions & 0 deletions docs/utilities/ssr.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ useHydrateAtoms([
] as const)
```

Or you may need to use a Map when passing the atom value to useHydrateAtoms. You can find a working example in the [Initializing State on Render docs](https://jotai.org/docs/guides/initialize-atom-on-render#using-typescript).

### Demo

<Stackblitz id="stackblitz-starters-b7cvxi" file="pages%2Findex.tsx" />
Expand Down
12 changes: 6 additions & 6 deletions examples/hacker_news/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Hacker News [![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?style=flat-square&logo=codesandbox)](https://githubbox.com/pmndrs/jotai/tree/main/examples/hacker_news)
# Hacker News [![Open in StackBlitz](https://img.shields.io/badge/Open%20in-StackBlitz-blue?style=flat-square&logo=stackblitz)](https://stackblitz.com/github/pmndrs/jotai/tree/main/examples/hacker_news)

## Description

Expand All @@ -10,15 +10,15 @@ Demonstrate a news articles with jotai, hit next to see more articles.
git clone https://github.com/pmndrs/jotai

# install project dependencies & build the library
cd jotai && yarn
cd jotai && pnpm install

# move to the examples folder & install dependencies
cd examples/hacker_news && yarn
cd examples/hacker_news && pnpm install

# start the dev server
yarn start
pnpm dev
```

## Set up on codesandbox
## Set up on `StackBlitz`

Link: https://githubbox.com/pmndrs/jotai/tree/main/examples/hacker_news
Link: https://stackblitz.com/github/pmndrs/jotai/tree/main/examples/hacker_news
6 changes: 3 additions & 3 deletions examples/hacker_news/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"dependencies": {
"@react-spring/web": "^9.2.3",
"html-react-parser": "^1.2.6",
"jotai": "^2.0.4",
"jotai": "^2.10.4",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@vitejs/plugin-react": "^4.0.0",
"@vitejs/plugin-react": "^4.3.4",
"typescript": "^5.0.0",
"vite": "^4.0.0"
"vite": "^6.0.5"
}
}
Loading

0 comments on commit 897e005

Please sign in to comment.