|
1 | 1 | /** @jest-environment jsdom */ |
2 | | -import { type ActivityLoaderArgs, defineConfig } from "@stackflow/config"; |
| 2 | +import { defineConfig } from "@stackflow/config"; |
3 | 3 | import type { Stack, StackflowActions } from "@stackflow/core"; |
4 | 4 | import { |
5 | 5 | type BlockedNavigation, |
|
9 | 9 | } from "@stackflow/plugin-blocker"; |
10 | 10 | import { basicRendererPlugin } from "@stackflow/plugin-renderer-basic"; |
11 | 11 | import type { StackflowReactPlugin } from "@stackflow/react"; |
12 | | -import { stackflow, useLoaderData } from "@stackflow/react"; |
| 12 | +import { stackflow } from "@stackflow/react"; |
13 | 13 | import { act, cleanup, render } from "@testing-library/react"; |
14 | 14 | import { createBrowserHistory } from "history"; |
15 | 15 | import { historySyncPlugin } from "./historySyncPlugin"; |
@@ -43,49 +43,19 @@ type SessionStorageAccess = SessionStorageShim | null | "throw"; |
43 | 43 | let currentBlocker: BlockerControls | null = null; |
44 | 44 | let restoreSessionStorage: (() => void) | null = null; |
45 | 45 |
|
46 | | -function homeLoader() { |
47 | | - return { |
48 | | - cards: ["home"], |
49 | | - }; |
50 | | -} |
51 | | - |
52 | | -function articleLoader({ params }: ActivityLoaderArgs<"Article">) { |
53 | | - return { |
54 | | - recommenderCards: [params.articleId], |
55 | | - }; |
56 | | -} |
57 | | - |
58 | 46 | function Home() { |
59 | | - const { cards } = useLoaderData<typeof homeLoader>(); |
60 | | - |
61 | | - return ( |
62 | | - <div data-testid="activity"> |
63 | | - home |
64 | | - {cards.map((card) => ( |
65 | | - <span key={card}>{card}</span> |
66 | | - ))} |
67 | | - </div> |
68 | | - ); |
| 47 | + return <div data-testid="activity">home</div>; |
69 | 48 | } |
70 | 49 |
|
71 | 50 | function Article() { |
72 | | - const { recommenderCards } = useLoaderData<typeof articleLoader>(); |
73 | | - |
74 | 51 | useBlocker({ |
75 | 52 | shouldBlock: (action) => currentBlocker?.shouldBlock(action) ?? false, |
76 | 53 | onBlocked: (blockedNavigation, actions) => { |
77 | 54 | currentBlocker?.onBlocked(blockedNavigation, actions); |
78 | 55 | }, |
79 | 56 | }); |
80 | 57 |
|
81 | | - return ( |
82 | | - <div data-testid="activity"> |
83 | | - article |
84 | | - {recommenderCards.map((card) => ( |
85 | | - <span key={card}>{card}</span> |
86 | | - ))} |
87 | | - </div> |
88 | | - ); |
| 58 | + return <div data-testid="activity">article</div>; |
89 | 59 | } |
90 | 60 |
|
91 | 61 | function path(browserWindow: Window) { |
@@ -379,8 +349,8 @@ async function renderHarness({ |
379 | 349 | const config = defineConfig({ |
380 | 350 | transitionDuration: 0, |
381 | 351 | activities: [ |
382 | | - { name: "Home", route: "/home", loader: homeLoader }, |
383 | | - { name: "Article", route: "/articles/:articleId", loader: articleLoader }, |
| 352 | + { name: "Home", route: "/home" }, |
| 353 | + { name: "Article", route: "/articles/:articleId" }, |
384 | 354 | ], |
385 | 355 | }); |
386 | 356 |
|
|
0 commit comments