Skip to content

Commit

Permalink
feat(react): react 19 support
Browse files Browse the repository at this point in the history
  • Loading branch information
tien committed Dec 6, 2024
1 parent 041ccd4 commit 4467c12
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 58 deletions.
5 changes: 5 additions & 0 deletions .changeset/clean-clocks-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reactive-dot/react": patch
---

Added React 19 support.
4 changes: 2 additions & 2 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"clsx": "^2.1.1",
"docusaurus-plugin-typedoc-api": "^4.4.0",
"prism-react-renderer": "^2.4.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.5.2",
Expand Down
10 changes: 5 additions & 5 deletions examples/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@
"date-fns": "^4.1.0",
"jotai-devtools": "^0.10.1",
"polkadot-api": "^1.7.6",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-error-boundary": "^4.1.2",
"react-hot-toast": "^2.4.1"
},
"devDependencies": {
"@reactive-dot/eslint-config": "workspace:^",
"@tsconfig/recommended": "^1.0.8",
"@tsconfig/strictest": "^2.0.5",
"@tsconfig/vite-react": "^3.4.0",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.16.0",
"typescript": "^5.7.2",
Expand Down
1 change: 1 addition & 0 deletions examples/react/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const config = defineConfig({
provider: lightClientProvider.addRelayChain({ id: "westend" }),
},
},
targetChains: ["polkadot", "kusama", "westend"],
wallets: [
new InjectedWalletProvider({ originName: "ReactiveDOT React Example" }),
new LedgerWallet(),
Expand Down
1 change: 1 addition & 0 deletions examples/vue/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const config = defineConfig({
provider: lightClientProvider.addRelayChain({ id: "westend" }),
},
},
targetChains: ["polkadot", "kusama", "westend"],
wallets: [
new InjectedWalletProvider({ originName: "ReactiveDOT React Example" }),
new LedgerWallet(),
Expand Down
6 changes: 3 additions & 3 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
"@reactive-dot/eslint-config": "workspace:^",
"@tsconfig/recommended": "^1.0.8",
"@tsconfig/strictest": "^2.0.5",
"@types/react": "^18.3.12",
"@types/react": "^19.0.0",
"eslint": "^9.16.0",
"polkadot-api": "^1.7.6",
"react": "^18.3.1",
"react": "^19.0.0",
"typescript": "^5.7.2"
},
"peerDependencies": {
"react": "18.x"
"react": "18.x || 19.x"
}
}
4 changes: 3 additions & 1 deletion packages/react/src/hooks/use-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from "@reactive-dot/core/internal.js";
import { type Atom, atom, useAtomValue, type WritableAtom } from "jotai";
import { atomWithObservable, atomWithRefresh } from "jotai/utils";
import { useMemo } from "react";
import React, { useMemo } from "react";
import { from, type Observable } from "rxjs";
import { switchMap } from "rxjs/operators";

Expand Down Expand Up @@ -75,6 +75,8 @@ export function useLazyLoadQuery<
// eslint-disable-next-line react-hooks/exhaustive-deps
[hashKey],
),
// TODO: remove once https://github.com/pmndrs/jotai/issues/2847 is fixed
React.version.startsWith("19.") ? { delay: 0 } : undefined,
);

return useMemo(
Expand Down
88 changes: 41 additions & 47 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4797,8 +4797,8 @@ __metadata:
clsx: "npm:^2.1.1"
docusaurus-plugin-typedoc-api: "npm:^4.4.0"
prism-react-renderer: "npm:^2.4.0"
react: "npm:^18.3.1"
react-dom: "npm:^18.3.1"
react: "npm:^19.0.0"
react-dom: "npm:^19.0.0"
typescript: "npm:^5.7.2"
languageName: unknown
linkType: soft
Expand Down Expand Up @@ -4833,16 +4833,16 @@ __metadata:
"@tsconfig/recommended": "npm:^1.0.8"
"@tsconfig/strictest": "npm:^2.0.5"
"@tsconfig/vite-react": "npm:^3.4.0"
"@types/react": "npm:^18.3.12"
"@types/react-dom": "npm:^18.3.1"
"@types/react": "npm:^19.0.0"
"@types/react-dom": "npm:^19.0.0"
"@vitejs/plugin-react": "npm:^4.3.4"
date-fns: "npm:^4.1.0"
eslint: "npm:^9.16.0"
jotai-devtools: "npm:^0.10.1"
polkadot-api: "npm:^1.7.6"
react: "npm:^18.3.1"
react-dom: "npm:^18.3.1"
react-error-boundary: "npm:^4.1.1"
react: "npm:^19.0.0"
react-dom: "npm:^19.0.0"
react-error-boundary: "npm:^4.1.2"
react-hot-toast: "npm:^2.4.1"
typescript: "npm:^5.7.2"
vite: "npm:^6.0.1"
Expand Down Expand Up @@ -4875,14 +4875,14 @@ __metadata:
"@reactive-dot/eslint-config": "workspace:^"
"@tsconfig/recommended": "npm:^1.0.8"
"@tsconfig/strictest": "npm:^2.0.5"
"@types/react": "npm:^18.3.12"
"@types/react": "npm:^19.0.0"
eslint: "npm:^9.16.0"
jotai: "npm:^2.10.3"
polkadot-api: "npm:^1.7.6"
react: "npm:^18.3.1"
react: "npm:^19.0.0"
typescript: "npm:^5.7.2"
peerDependencies:
react: 18.x
react: 18.x || 19.x
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -6078,12 +6078,12 @@ __metadata:
languageName: node
linkType: hard

"@types/react-dom@npm:^18.3.1":
version: 18.3.1
resolution: "@types/react-dom@npm:18.3.1"
"@types/react-dom@npm:^19.0.0":
version: 19.0.0
resolution: "@types/react-dom@npm:19.0.0"
dependencies:
"@types/react": "npm:*"
checksum: 10c0/8b416551c60bb6bd8ec10e198c957910cfb271bc3922463040b0d57cf4739cdcd24b13224f8d68f10318926e1ec3cd69af0af79f0291b599a992f8c80d47f1eb
checksum: 10c0/bd480fc4a9c801fc6bbc7d26b37bb815fc382e76b5428511b1bdb2e8048f3dbd2ff9973bafc86b448e0593f9da4c02f7b39d47409e427daeed5a54f045de4596
languageName: node
linkType: hard

Expand Down Expand Up @@ -6129,13 +6129,12 @@ __metadata:
languageName: node
linkType: hard

"@types/react@npm:^18.3.12":
version: 18.3.12
resolution: "@types/react@npm:18.3.12"
"@types/react@npm:^19.0.0":
version: 19.0.0
resolution: "@types/react@npm:19.0.0"
dependencies:
"@types/prop-types": "npm:*"
csstype: "npm:^3.0.2"
checksum: 10c0/8bae8d9a41619804561574792e29112b413044eb0d53746dde2b9720c1f9a59f71c895bbd7987cd8ce9500b00786e53bc032dced38cddf42910458e145675290
checksum: 10c0/d7753ec27c5fa48f3aab97d7d4e9e33ad62bbff761a421bfc56c7b403fab9e3ed266d47793e44311ca2f0034e8ae428cea4aecbe1c542b418cfe72a520eab931
languageName: node
linkType: hard

Expand Down Expand Up @@ -13304,7 +13303,7 @@ __metadata:
languageName: node
linkType: hard

"loose-envify@npm:^1.0.0, loose-envify@npm:^1.1.0, loose-envify@npm:^1.2.0, loose-envify@npm:^1.3.1, loose-envify@npm:^1.4.0":
"loose-envify@npm:^1.0.0, loose-envify@npm:^1.2.0, loose-envify@npm:^1.3.1, loose-envify@npm:^1.4.0":
version: 1.4.0
resolution: "loose-envify@npm:1.4.0"
dependencies:
Expand Down Expand Up @@ -16553,15 +16552,14 @@ __metadata:
languageName: node
linkType: hard

"react-dom@npm:^18.3.1":
version: 18.3.1
resolution: "react-dom@npm:18.3.1"
"react-dom@npm:^19.0.0":
version: 19.0.0
resolution: "react-dom@npm:19.0.0"
dependencies:
loose-envify: "npm:^1.1.0"
scheduler: "npm:^0.23.2"
scheduler: "npm:^0.25.0"
peerDependencies:
react: ^18.3.1
checksum: 10c0/a752496c1941f958f2e8ac56239172296fcddce1365ce45222d04a1947e0cc5547df3e8447f855a81d6d39f008d7c32eab43db3712077f09e3f67c4874973e85
react: ^19.0.0
checksum: 10c0/a36ce7ab507b237ae2759c984cdaad4af4096d8199fb65b3815c16825e5cfeb7293da790a3fc2184b52bfba7ba3ff31c058c01947aff6fd1a3701632aabaa6a9
languageName: node
linkType: hard

Expand All @@ -16576,14 +16574,14 @@ __metadata:
languageName: node
linkType: hard

"react-error-boundary@npm:^4.1.1":
version: 4.1.1
resolution: "react-error-boundary@npm:4.1.1"
"react-error-boundary@npm:^4.1.2":
version: 4.1.2
resolution: "react-error-boundary@npm:4.1.2"
dependencies:
"@babel/runtime": "npm:^7.12.5"
peerDependencies:
react: ">=16.13.1"
checksum: 10c0/0faa4236833a5d98844f84180c8f54316b555bb3e1b38b37d59e6edf8baa754c4fad4570155dc49de61558a0e912fb7143554657f9abccf8ccd08fbee1bd7ac4
checksum: 10c0/0737e5259bed40ce14eb0823b3c7b152171921f2179e604f48f3913490cdc594d6c22d43d7abb4ffb1512c832850228db07aa69d3b941db324953a5e393cb399
languageName: node
linkType: hard

Expand Down Expand Up @@ -16844,12 +16842,10 @@ __metadata:
languageName: node
linkType: hard

"react@npm:^18.3.1":
version: 18.3.1
resolution: "react@npm:18.3.1"
dependencies:
loose-envify: "npm:^1.1.0"
checksum: 10c0/283e8c5efcf37802c9d1ce767f302dd569dd97a70d9bb8c7be79a789b9902451e0d16334b05d73299b20f048cbc3c7d288bbbde10b701fa194e2089c237dbea3
"react@npm:^19.0.0":
version: 19.0.0
resolution: "react@npm:19.0.0"
checksum: 10c0/9cad8f103e8e3a16d15cb18a0d8115d8bd9f9e1ce3420310aea381eb42aa0a4f812cf047bb5441349257a05fba8a291515691e3cb51267279b2d2c3253f38471
languageName: node
linkType: hard

Expand Down Expand Up @@ -17539,12 +17535,10 @@ __metadata:
languageName: node
linkType: hard

"scheduler@npm:^0.23.2":
version: 0.23.2
resolution: "scheduler@npm:0.23.2"
dependencies:
loose-envify: "npm:^1.1.0"
checksum: 10c0/26383305e249651d4c58e6705d5f8425f153211aef95f15161c151f7b8de885f24751b377e4a0b3dd42cce09aad3f87a61dab7636859c0d89b7daf1a1e2a5c78
"scheduler@npm:^0.25.0":
version: 0.25.0
resolution: "scheduler@npm:0.25.0"
checksum: 10c0/a4bb1da406b613ce72c1299db43759526058fdcc413999c3c3e0db8956df7633acf395cb20eb2303b6a65d658d66b6585d344460abaee8080b4aa931f10eaafe
languageName: node
linkType: hard

Expand Down Expand Up @@ -19059,21 +19053,21 @@ __metadata:

"typescript@patch:typescript@npm%3A^5.6.3#optional!builtin<compat/typescript>":
version: 5.6.3
resolution: "typescript@patch:typescript@npm%3A5.6.3#optional!builtin<compat/typescript>::version=5.6.3&hash=8c6c40"
resolution: "typescript@patch:typescript@npm%3A5.6.3#optional!builtin<compat/typescript>::version=5.6.3&hash=74658d"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/7c9d2e07c81226d60435939618c91ec2ff0b75fbfa106eec3430f0fcf93a584bc6c73176676f532d78c3594fe28a54b36eb40b3d75593071a7ec91301533ace7
checksum: 10c0/ac8307bb06bbfd08ae7137da740769b7d8c3ee5943188743bb622c621f8ad61d244767480f90fbd840277fbf152d8932aa20c33f867dea1bb5e79b187ca1a92f
languageName: node
linkType: hard

"typescript@patch:typescript@npm%3A^5.7.2#optional!builtin<compat/typescript>":
version: 5.7.2
resolution: "typescript@patch:typescript@npm%3A5.7.2#optional!builtin<compat/typescript>::version=5.7.2&hash=5786d5"
resolution: "typescript@patch:typescript@npm%3A5.7.2#optional!builtin<compat/typescript>::version=5.7.2&hash=74658d"
bin:
tsc: bin/tsc
tsserver: bin/tsserver
checksum: 10c0/f3b8082c9d1d1629a215245c9087df56cb784f9fb6f27b5d55577a20e68afe2a889c040aacff6d27e35be165ecf9dca66e694c42eb9a50b3b2c451b36b5675cb
checksum: 10c0/c891ccf04008bc1305ba34053db951f8a4584b4a1bf2f68fd972c4a354df3dc5e62c8bfed4f6ac2d12e5b3b1c49af312c83a651048f818cd5b4949d17baacd79
languageName: node
linkType: hard

Expand Down

0 comments on commit 4467c12

Please sign in to comment.