Skip to content

Commit 8fd9678

Browse files
committed
feat: optimize runtime and server context
1 parent 8cae8af commit 8fd9678

File tree

2 files changed

+3
-4
lines changed
  • packages/runtime/plugin-runtime/src/router/runtime
  • tests/integration/rsc-ssr-app/src/client-component-root

2 files changed

+3
-4
lines changed

packages/runtime/plugin-runtime/src/router/runtime/PrefetchLink.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ import type {
1717
MouseEventHandler,
1818
TouchEventHandler,
1919
} from 'react';
20-
import { RuntimeContext } from '../../core';
21-
import type { TInternalRuntimeContext } from '../../core/context/runtime';
20+
import { InternalRuntimeContext } from '../../core/context';
2221
import type { RouteAssets, RouteManifest } from './types';
2322

2423
interface PrefetchHandlers {
@@ -188,7 +187,7 @@ const getDataHref = (
188187

189188
const PrefetchPageLinks: React.FC<{ path: Path }> = ({ path }) => {
190189
const { pathname } = path;
191-
const context = useContext(RuntimeContext) as TInternalRuntimeContext;
190+
const context = useContext(InternalRuntimeContext);
192191
const { routeManifest, routes } = context;
193192
const { routeAssets } = routeManifest || {};
194193
const matches = Array.isArray(routes) ? matchRoutes(routes, pathname) : [];

tests/integration/rsc-ssr-app/src/client-component-root/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const App = () => {
5353
<div className="container">
5454
<main>
5555
<div className="user-agent">
56-
{typeof context.ssrContext?.request?.userAgent}
56+
{typeof context.context?.request?.userAgent}
5757
</div>
5858
<div className="logo">
5959
<img

0 commit comments

Comments
 (0)