Skip to content

Commit 4621ed9

Browse files
committed
[compiler][playground] Upgrade to Next 15.2.0-canary.64
Upgrade compiler playground to use the newest nextjs release, which includes react compiler transform pipeline optimizations vercel/next.js#75676. Also made a drive-by fix to avoid the error `Cannot update a component ('Router') while rendering a different component ('StoreProvider'). To locate the bad setState() call inside 'StoreProvider', follow the stack trace as described in https://react.dev/link/setstate-in-render`. The bad setState came from `history.replaceState({}, '', \`#${hash}\`);`. Prior to this, playground ran side effects in a reducer (i.e. during render). These have now been moved an effect.
1 parent fcb4e0f commit 4621ed9

File tree

4 files changed

+76
-72
lines changed

4 files changed

+76
-72
lines changed

compiler/apps/playground/components/StoreContext.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
*/
77

88
import type {Dispatch, ReactNode} from 'react';
9-
import {useReducer} from 'react';
9+
import {useEffect, useReducer} from 'react';
1010
import createContext from '../lib/createContext';
1111
import {emptyStore} from '../lib/defaultStore';
12-
import type {Store} from '../lib/stores';
13-
import {saveStore} from '../lib/stores';
12+
import {saveStore, type Store} from '../lib/stores';
1413

1514
const StoreContext = createContext<Store>();
1615

@@ -31,6 +30,11 @@ export const useStoreDispatch = StoreDispatchContext.useContext;
3130
*/
3231
export function StoreProvider({children}: {children: ReactNode}): JSX.Element {
3332
const [store, dispatch] = useReducer(storeReducer, emptyStore);
33+
useEffect(() => {
34+
if (store !== emptyStore) {
35+
saveStore(store);
36+
}
37+
}, [store]);
3438

3539
return (
3640
<StoreContext.Provider value={store}>
@@ -59,19 +63,14 @@ function storeReducer(store: Store, action: ReducerAction): Store {
5963
switch (action.type) {
6064
case 'setStore': {
6165
const newStore = action.payload.store;
62-
63-
saveStore(newStore);
6466
return newStore;
6567
}
6668
case 'updateFile': {
6769
const {source} = action.payload;
68-
6970
const newStore = {
7071
...store,
7172
source,
7273
};
73-
74-
saveStore(newStore);
7574
return newStore;
7675
}
7776
}

compiler/apps/playground/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
/// <reference types="next/image-types/global" />
33

44
// NOTE: This file should not be edited
5-
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
5+
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

compiler/apps/playground/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"invariant": "^2.2.4",
3535
"lz-string": "^1.5.0",
3636
"monaco-editor": "^0.52.0",
37-
"next": "^15.0.1",
37+
"next": "^15.2.0-canary.64",
3838
"notistack": "^3.0.0-alpha.7",
3939
"prettier": "^3.3.3",
4040
"pretty-format": "^29.3.1",

compiler/apps/playground/yarn.lock

Lines changed: 67 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -589,10 +589,10 @@
589589
dependencies:
590590
"@monaco-editor/loader" "^1.4.0"
591591

592-
"@next/env@15.0.1":
593-
version "15.0.1"
594-
resolved "https://registry.yarnpkg.com/@next/env/-/env-15.0.1.tgz#660fe9303e255cec112d3f4198d2897a24bc60b3"
595-
integrity sha512-lc4HeDUKO9gxxlM5G2knTRifqhsY6yYpwuHspBZdboZe0Gp+rZHBNNSIjmQKDJIdRXiXGyVnSD6gafrbQPvILQ==
592+
"@next/env@15.2.0-canary.66":
593+
version "15.2.0-canary.66"
594+
resolved "https://registry.yarnpkg.com/@next/env/-/env-15.2.0-canary.66.tgz#c4ca0d502ad099c68927643df9c9b5d75c7b7fbb"
595+
integrity sha512-/RxW1GJ7a6MJOQ7LOa2bcli7VTjqB7jPyzXwNJQflcYJH4gz1kP6uzg8+IptLJGFSRB58RBKHJk+q1cD8jongA==
596596

597597
598598
version "15.0.1"
@@ -601,45 +601,45 @@
601601
dependencies:
602602
fast-glob "3.3.1"
603603

604-
"@next/swc-darwin-arm64@15.0.1":
605-
version "15.0.1"
606-
resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.0.1.tgz#b80a25f1569bd0ca03eca9473f7e93e64937e404"
607-
integrity sha512-C9k/Xv4sxkQRTA37Z6MzNq3Yb1BJMmSqjmwowoWEpbXTkAdfOwnoKOpAb71ItSzoA26yUTIo6ZhN8rKGu4ExQw==
608-
609-
"@next/swc-darwin-x64@15.0.1":
610-
version "15.0.1"
611-
resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-15.0.1.tgz#00dcf79ec7c638a85c3b9ff2e2de2bfb09c1c250"
612-
integrity sha512-uHl13HXOuq1G7ovWFxCACDJHTSDVbn/sbLv8V1p+7KIvTrYQ5HNoSmKBdYeEKRRCbEmd+OohOgg9YOp8Ux3MBg==
613-
614-
"@next/swc-linux-arm64-gnu@15.0.1":
615-
version "15.0.1"
616-
resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.0.1.tgz#faab5f7ffcc6d1a15e8dea1cb9953966658b39bf"
617-
integrity sha512-LvyhvxHOihFTEIbb35KxOc3q8w8G4xAAAH/AQnsYDEnOvwawjL2eawsB59AX02ki6LJdgDaHoTEnC54Gw+82xw==
618-
619-
"@next/swc-linux-arm64-musl@15.0.1":
620-
version "15.0.1"
621-
resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.0.1.tgz#97abada9a782ab5b3cb42cf0d4799cbc2e733351"
622-
integrity sha512-vFmCGUFNyk/A5/BYcQNhAQqPIw01RJaK6dRO+ZEhz0DncoW+hJW1kZ8aH2UvTX27zPq3m85zN5waMSbZEmANcQ==
623-
624-
"@next/swc-linux-x64-gnu@15.0.1":
625-
version "15.0.1"
626-
resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.0.1.tgz#548bd47c49fe6d819302139aff8766eb704322e2"
627-
integrity sha512-5by7IYq0NCF8rouz6Qg9T97jYU68kaClHPfGpQG2lCZpSYHtSPQF1kjnqBTd34RIqPKMbCa4DqCufirgr8HM5w==
628-
629-
"@next/swc-linux-x64-musl@15.0.1":
630-
version "15.0.1"
631-
resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.0.1.tgz#84423fbd3a058dd6ae8322e530878f0ec7a1027a"
632-
integrity sha512-lmYr6H3JyDNBJLzklGXLfbehU3ay78a+b6UmBGlHls4xhDXBNZfgb0aI67sflrX+cGBnv1LgmWzFlYrAYxS1Qw==
633-
634-
"@next/swc-win32-arm64-msvc@15.0.1":
635-
version "15.0.1"
636-
resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.0.1.tgz#723c2ced12a998fb40dc901b8faea9170e788c2f"
637-
integrity sha512-DS8wQtl6diAj0eZTdH0sefykm4iXMbHT4MOvLwqZiIkeezKpkgPFcEdFlz3vKvXa2R/2UEgMh48z1nEpNhjeOQ==
638-
639-
"@next/swc-win32-x64-msvc@15.0.1":
640-
version "15.0.1"
641-
resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.0.1.tgz#ec7e3befc0bcc47527537b1eda2b3745beb15a09"
642-
integrity sha512-4Ho2ggvDdMKlZ/0e9HNdZ9ngeaBwtc+2VS5oCeqrbXqOgutX6I4U2X/42VBw0o+M5evn4/7v3zKgGHo+9v/VjA==
604+
"@next/swc-darwin-arm64@15.2.0-canary.66":
605+
version "15.2.0-canary.66"
606+
resolved "https://registry.yarnpkg.com/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.2.0-canary.66.tgz#368438cf713c439b5b4c44d54b5c3b31ee5b772d"
607+
integrity sha512-sVzNJWTekcLOdqkDMistBGr84AVh9eSu4o5JQNEOdxHry4jiF8lqixpOg0+Twj2RRuv4bx32h5xaRVvCSUpITQ==
608+
609+
"@next/swc-darwin-x64@15.2.0-canary.66":
610+
version "15.2.0-canary.66"
611+
resolved "https://registry.yarnpkg.com/@next/swc-darwin-x64/-/swc-darwin-x64-15.2.0-canary.66.tgz#3ddc3f4f6e86e204727770e5984cabf52f852472"
612+
integrity sha512-Avv6Nf/0j0WVqY72Q0mK2glGhvN7LT7iVF31iBYUe/Cbf2cXBjgpXUVmksJjg+2Fi6uTEpaMoZWSVEpJyPkjVQ==
613+
614+
"@next/swc-linux-arm64-gnu@15.2.0-canary.66":
615+
version "15.2.0-canary.66"
616+
resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.2.0-canary.66.tgz#cd3683bf569c66444340b1e4d876913584e93aea"
617+
integrity sha512-kUPejaStjKpF79fz4525DKQKADtUuE+T6j7IvLQsZuWrSX3a5Mix+i52fdTzMJ+sFGg3v147wopZt6L6JMIxxA==
618+
619+
"@next/swc-linux-arm64-musl@15.2.0-canary.66":
620+
version "15.2.0-canary.66"
621+
resolved "https://registry.yarnpkg.com/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.2.0-canary.66.tgz#453836b11efdb50b91cf8a6cfbce8779f6778dd9"
622+
integrity sha512-U8l8jaZ+BAU5wn3bw7PRqq4vGTpObBt+7JbJLpbDqB1GfkZdCDc4nGtqAfLy3pY0O4lEfqal9jrsEVtUBCbfHg==
623+
624+
"@next/swc-linux-x64-gnu@15.2.0-canary.66":
625+
version "15.2.0-canary.66"
626+
resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.2.0-canary.66.tgz#f02b295febaacf8d041f9f149c30c41aea16a81f"
627+
integrity sha512-c+AV8ZN1znGBHu5BACGym+9FhV8+213XVHFI7i2J7TSsJ6T+Eofhwn0tSn1Vy/XpVmpyoEdkwepL+djbdQAGhw==
628+
629+
"@next/swc-linux-x64-musl@15.2.0-canary.66":
630+
version "15.2.0-canary.66"
631+
resolved "https://registry.yarnpkg.com/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.2.0-canary.66.tgz#f942c000ba3ffc0289520d25fa1067a75e72fa41"
632+
integrity sha512-4mTIv86qyXuo8NfjigSQ7rk2cDwM8/f8R/kf3hNh8NF1Aaat2RrEet9a/SbsuNpdhhNnPI5RcRwpIJx2JQSPcQ==
633+
634+
"@next/swc-win32-arm64-msvc@15.2.0-canary.66":
635+
version "15.2.0-canary.66"
636+
resolved "https://registry.yarnpkg.com/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.2.0-canary.66.tgz#0ffdcf5c74b5aa6214307f2ae4aa84f1526e6bf9"
637+
integrity sha512-NPnfsDQXk44h8VtncWq2AgLjHDbUMsc8Tpz7pcLe9qb8lZSxZ9jYbV7NwKzgd+qJbjy/58vgCWhL5PhyXDlWwQ==
638+
639+
"@next/swc-win32-x64-msvc@15.2.0-canary.66":
640+
version "15.2.0-canary.66"
641+
resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.2.0-canary.66.tgz#458245850cf407d2551155e4662785c109f58bda"
642+
integrity sha512-L/ef++GJqW+T3g2x6mrZ2vrBK+6QS9Ieam8EqK9dG7cFKv7Gqm9yrHvDuVse62hnNB11ZdxfDDKrs9vabuQLlw==
643643

644644
"@nodelib/[email protected]":
645645
version "2.1.5"
@@ -716,12 +716,12 @@
716716
resolved "https://registry.yarnpkg.com/@swc/counter/-/counter-0.1.3.tgz#cc7463bd02949611c6329596fccd2b0ec782b0e9"
717717
integrity sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==
718718

719-
720-
version "0.5.13"
721-
resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.13.tgz#33e63ff3cd0cade557672bd7888a39ce7d115a8c"
722-
integrity sha512-UoKGxQ3r5kYI9dALKJapMmuK+1zWM/H17Z1+iwnNmzcJRnfFuevZs375TA5rW31pu4BS4NoSy1fRsexDXfWn5w==
719+
720+
version "0.5.15"
721+
resolved "https://registry.yarnpkg.com/@swc/helpers/-/helpers-0.5.15.tgz#79efab344c5819ecf83a43f3f9f811fc84b516d7"
722+
integrity sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==
723723
dependencies:
724-
tslib "^2.4.0"
724+
tslib "^2.8.0"
725725

726726
"@types/json5@^0.0.29":
727727
version "0.0.29"
@@ -2682,27 +2682,27 @@ natural-compare@^1.4.0:
26822682
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
26832683
integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==
26842684

2685-
next@^15.0.1:
2686-
version "15.0.1"
2687-
resolved "https://registry.yarnpkg.com/next/-/next-15.0.1.tgz#a0e8eda35d803cb7f8092b2a2eb9d072e22bf21d"
2688-
integrity sha512-PSkFkr/w7UnFWm+EP8y/QpHrJXMqpZzAXpergB/EqLPOh4SGPJXv1wj4mslr2hUZBAS9pX7/9YLIdxTv6fwytw==
2685+
next@^15.2.0-canary.64:
2686+
version "15.2.0-canary.66"
2687+
resolved "https://registry.yarnpkg.com/next/-/next-15.2.0-canary.66.tgz#cb5ee4453c88f247b6e74fe33fd181eca58e7c86"
2688+
integrity sha512-S+gsEu8vxxejI7nKqtCLqZlTi9L40xelLRK/Fgtvm/XT8W8ziLp3KMtN4I9Si5nEMU5uv7bllIfd04kVX8+HIw==
26892689
dependencies:
2690-
"@next/env" "15.0.1"
2690+
"@next/env" "15.2.0-canary.66"
26912691
"@swc/counter" "0.1.3"
2692-
"@swc/helpers" "0.5.13"
2692+
"@swc/helpers" "0.5.15"
26932693
busboy "1.6.0"
26942694
caniuse-lite "^1.0.30001579"
26952695
postcss "8.4.31"
26962696
styled-jsx "5.1.6"
26972697
optionalDependencies:
2698-
"@next/swc-darwin-arm64" "15.0.1"
2699-
"@next/swc-darwin-x64" "15.0.1"
2700-
"@next/swc-linux-arm64-gnu" "15.0.1"
2701-
"@next/swc-linux-arm64-musl" "15.0.1"
2702-
"@next/swc-linux-x64-gnu" "15.0.1"
2703-
"@next/swc-linux-x64-musl" "15.0.1"
2704-
"@next/swc-win32-arm64-msvc" "15.0.1"
2705-
"@next/swc-win32-x64-msvc" "15.0.1"
2698+
"@next/swc-darwin-arm64" "15.2.0-canary.66"
2699+
"@next/swc-darwin-x64" "15.2.0-canary.66"
2700+
"@next/swc-linux-arm64-gnu" "15.2.0-canary.66"
2701+
"@next/swc-linux-arm64-musl" "15.2.0-canary.66"
2702+
"@next/swc-linux-x64-gnu" "15.2.0-canary.66"
2703+
"@next/swc-linux-x64-musl" "15.2.0-canary.66"
2704+
"@next/swc-win32-arm64-msvc" "15.2.0-canary.66"
2705+
"@next/swc-win32-x64-msvc" "15.2.0-canary.66"
27062706
sharp "^0.33.5"
27072707

27082708
node-releases@^2.0.18:
@@ -3559,6 +3559,11 @@ tslib@^2.1.0, tslib@^2.4.0:
35593559
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01"
35603560
integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==
35613561

3562+
tslib@^2.8.0:
3563+
version "2.8.1"
3564+
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.8.1.tgz#612efe4ed235d567e8aba5f2a5fab70280ade83f"
3565+
integrity sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==
3566+
35623567
type-check@^0.4.0, type-check@~0.4.0:
35633568
version "0.4.0"
35643569
resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"

0 commit comments

Comments
 (0)