Skip to content

Commit 687bb87

Browse files
committed
fix lint/test issues
1 parent 5322426 commit 687bb87

File tree

5 files changed

+224
-135
lines changed

5 files changed

+224
-135
lines changed

integration/browser-entry-test.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,25 +87,32 @@ test("allows users to pass a client side context to HydratedRouter", async ({
8787
let fixture = await createFixture({
8888
files: {
8989
"app/entry.client.tsx": js`
90+
import { unstable_createContext } from "react-router";
9091
import { HydratedRouter } from "react-router/dom";
9192
import { startTransition, StrictMode } from "react";
9293
import { hydrateRoot } from "react-dom/client";
9394
95+
export const initialContext = new unstable_createContext('empty');
96+
9497
startTransition(() => {
9598
hydrateRoot(
9699
document,
97100
<StrictMode>
98-
<HydratedRouter unstable_context={{ foo: 'bar' }} />
101+
<HydratedRouter unstable_getContext={() => {
102+
return new Map([[initialContext, 'bar']]);
103+
}} />
99104
</StrictMode>
100105
);
101106
});
102107
`,
103108
"app/routes/_index.tsx": js`
109+
import { initialContext } from "../entry.client";
110+
104111
export function clientLoader({ context }) {
105-
return context;
112+
return context.get(initialContext);
106113
}
107114
export default function Index({ loaderData }) {
108-
return <h1>Hello, {loaderData.foo}</h1>
115+
return <h1>Hello, {loaderData}</h1>
109116
}
110117
`,
111118
},

0 commit comments

Comments
 (0)