Skip to content

Commit

Permalink
Switch from React canary back to experimental
Browse files Browse the repository at this point in the history
This is mostly in preparation for adding PPR (`prerender`/`resume`).
  • Loading branch information
unstubbable committed Apr 9, 2024
1 parent b24dda1 commit 3c81b56
Show file tree
Hide file tree
Showing 10 changed files with 203 additions and 220 deletions.
8 changes: 4 additions & 4 deletions apps/aws-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
"dependencies": {
"@mfng/core": "*",
"@mfng/shared-app": "*",
"react": "18.3.0-canary-2f8f77602-20240229",
"react-dom": "18.3.0-canary-2f8f77602-20240229"
"react": "0.0.0-experimental-e3ebcd54b-20240405",
"react-dom": "0.0.0-experimental-e3ebcd54b-20240405"
},
"devDependencies": {
"@hono/node-server": "^1.8.2",
"@mfng/webpack-rsc": "*",
"@swc/core": "^1.3.22",
"@types/aws-lambda": "^8.10.136",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"@types/react": "^18.2.75",
"@types/react-dom": "^18.2.24",
"autoprefixer": "^10.4.14",
"aws-cdk": "^2.132.1",
"aws-cdk-lib": "^2.132.1",
Expand Down
10 changes: 5 additions & 5 deletions apps/cloudflare-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"dependencies": {
"@mfng/core": "*",
"@mfng/shared-app": "*",
"react": "18.3.0-canary-2f8f77602-20240229",
"react-dom": "18.3.0-canary-2f8f77602-20240229"
"react": "0.0.0-experimental-e3ebcd54b-20240405",
"react-dom": "0.0.0-experimental-e3ebcd54b-20240405"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20240222.0",
Expand All @@ -28,8 +28,8 @@
"@swc/core": "^1.3.22",
"@swc/jest": "^0.2.24",
"@types/jest": "^29.4.0",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"@types/react": "^18.2.75",
"@types/react-dom": "^18.2.24",
"autoprefixer": "^10.4.14",
"copy-webpack-plugin": "^11.0.0",
"css-loader": "^6.7.3",
Expand All @@ -38,7 +38,7 @@
"mini-css-extract-plugin": "^2.7.5",
"postcss": "^8.4.21",
"postcss-loader": "^7.0.2",
"react-server-dom-webpack": "18.3.0-canary-2f8f77602-20240229",
"react-server-dom-webpack": "0.0.0-experimental-e3ebcd54b-20240405",
"resolve-typescript-plugin": "^2.0.0",
"source-map-loader": "^4.0.1",
"swc-loader": "^0.2.3",
Expand Down
8 changes: 4 additions & 4 deletions apps/shared-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
"clsx": "^1.2.1",
"countries-list": "^2.6.1",
"fuse.js": "^6.6.2",
"react": "18.3.0-canary-2f8f77602-20240229",
"react-dom": "18.3.0-canary-2f8f77602-20240229",
"react": "0.0.0-experimental-e3ebcd54b-20240405",
"react-dom": "0.0.0-experimental-e3ebcd54b-20240405",
"react-markdown": "^8.0.5",
"server-only": "^0.0.1",
"zod": "^3.21.4"
},
"devDependencies": {
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"@types/react": "^18.2.75",
"@types/react-dom": "^18.2.24",
"tailwindcss": "^3.2.7"
}
}
11 changes: 5 additions & 6 deletions apps/shared-app/src/client/button.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
'use client';

import * as React from 'react';
import * as ReactDOM from 'react-dom';
import {trackClick} from '../server/track-click.js';

export type ButtonProps = React.PropsWithChildren<{}>;

export function Button({children}: ButtonProps): React.ReactNode {
const {pending} = ReactDOM.useFormStatus();
export type ButtonProps = React.PropsWithChildren<{
readonly disabled?: boolean;
}>;

export function Button({children, disabled}: ButtonProps): React.ReactNode {
return (
<button
onClick={() => void trackClick()}
disabled={pending}
disabled={disabled}
className="rounded-full bg-cyan-500 py-1 px-4 text-white disabled:bg-zinc-300"
>
{children}
Expand Down
5 changes: 2 additions & 3 deletions apps/shared-app/src/client/product.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import {clsx} from 'clsx';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import type {BuyResult} from '../server/buy.js';
import {Notification} from '../shared/notification.js';
import {Button} from './button.js';
Expand All @@ -15,7 +14,7 @@ export interface ProductProps {
}

export function Product({buy}: ProductProps): React.ReactNode {
const [result, formAction] = ReactDOM.useFormState(buy, undefined);
const [result, formAction, isPending] = React.useActionState(buy, undefined);

return (
<form action={formAction}>
Expand Down Expand Up @@ -44,7 +43,7 @@ export function Product({buy}: ProductProps): React.ReactNode {
)}
/>
{` `}
<Button>Buy now</Button>
<Button disabled={isPending}>Buy now</Button>
{result && (
<Notification status={result.status}>
{result.status === `success` ? (
Expand Down
8 changes: 4 additions & 4 deletions apps/vercel-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@
"@mfng/core": "*",
"@mfng/shared-app": "*",
"@vercel/analytics": "^0.1.11",
"react": "18.3.0-canary-2f8f77602-20240229",
"react-dom": "18.3.0-canary-2f8f77602-20240229",
"react": "0.0.0-experimental-e3ebcd54b-20240405",
"react-dom": "0.0.0-experimental-e3ebcd54b-20240405",
"web-vitals": "^3.3.1"
},
"devDependencies": {
"@hono/node-server": "^1.8.2",
"@mfng/webpack-rsc": "*",
"@swc/core": "^1.3.22",
"@types/react": "^18.2.61",
"@types/react-dom": "^18.2.19",
"@types/react": "^18.2.75",
"@types/react-dom": "^18.2.24",
"autoprefixer": "^10.4.14",
"chokidar": "^3.6.0",
"copy-webpack-plugin": "^11.0.0",
Expand Down
Loading

0 comments on commit 3c81b56

Please sign in to comment.