Skip to content

Commit d44deae

Browse files
rickhanloniieps1lon
authored andcommitted
Fix Activity sandboxes (#8035)
* Fix Activity sandboxes * hacky fix
1 parent 74b67b1 commit d44deae

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/content/blog/2025/04/23/react-labs-view-transitions-activity-and-more.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11542,7 +11542,7 @@ Try searching for a video, selecting it, and clicking "back":
1154211542
<Sandpack>
1154311543

1154411544
```js src/App.js
11545-
import { unstable_ViewTransition as ViewTransition, Activity } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router";
11545+
import { unstable_ViewTransition as ViewTransition } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router"; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
1154611546

1154711547
export default function App() {
1154811548
const { url } = useRouter();
@@ -12879,7 +12879,7 @@ With this update, if the content on the next page has time to pre-render, it wil
1287912879
<Sandpack>
1288012880
1288112881
```js src/App.js
12882-
import { unstable_ViewTransition as ViewTransition, Activity, use } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router"; import {fetchVideos} from './data'
12882+
import { unstable_ViewTransition as ViewTransition, use } from "react"; import Details from "./Details"; import Home from "./Home"; import { useRouter } from "./router"; import {fetchVideos} from './data'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
1288312883

1288412884
export default function App() {
1288512885
const { url } = useRouter();

src/content/reference/react/Activity.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ and check out the new behavior:
206206
<Sandpack>
207207

208208
```js src/App.js active
209-
import { Activity, useState } from 'react';
209+
import { useState } from 'react'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
210+
210211
import Sidebar from './Sidebar.js';
211212

212213
export default function App() {
@@ -425,7 +426,7 @@ If we switch to using an Activity boundary to show and hide the active tab, we c
425426
<Sandpack>
426427
427428
```js src/App.js active
428-
import { useState, Activity } from 'react';
429+
import { useState } from 'react'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
429430
import TabButton from './TabButton.js';
430431
import Home from './Home.js';
431432
import Contact from './Contact.js';
@@ -703,7 +704,7 @@ Try clicking the Posts tab now:
703704
<Sandpack>
704705
705706
```js src/App.js
706-
import { useState, Suspense, Activity } from 'react';
707+
import { useState, Suspense } from 'react'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
707708
import TabButton from './TabButton.js';
708709
import Home from './Home.js';
709710
import Posts from './Posts.js';
@@ -1127,7 +1128,7 @@ Let's update `App` to hide the inactive tab with a hidden Activity boundary inst
11271128
<Sandpack>
11281129
11291130
```js src/App.js active
1130-
import { useState, Activity } from 'react';
1131+
import { useState } from 'react'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
11311132
import TabButton from './TabButton.js';
11321133
import Home from './Home.js';
11331134
import Video from './Video.js';
@@ -1261,7 +1262,7 @@ Let's see the new behavior. Try playing the video, switching to the Home tab, th
12611262
<Sandpack>
12621263
12631264
```js src/App.js active
1264-
import { useState, Activity } from 'react';
1265+
import { useState } from 'react'; import { unstable_Activity, Activity as ActivityStable} from 'react'; let Activity = ActivityStable ?? unstable_Activity;
12651266
import TabButton from './TabButton.js';
12661267
import Home from './Home.js';
12671268
import Video from './Video.js';

0 commit comments

Comments
 (0)