Skip to content

Commit 3be00d2

Browse files
committed
Rename to unstable_runClientMiddleware
1 parent cbb9d74 commit 3be00d2

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

.changeset/silent-snakes-mix.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
"react-router": patch
33
---
44

5-
UNSTABLE: Add a new `unstable_runMiddleware` argument to `dataStrategy` to enable middleware execution in custom `dataStrategy` implementations
5+
UNSTABLE: Add a new `unstable_runClientMiddleware` argument to `dataStrategy` to enable middleware execution in custom `dataStrategy` implementations

packages/react-router/lib/dom/ssr/single-fetch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ export function getSingleFetchDataStrategy(
160160
basename,
161161
getRouter
162162
);
163-
return async (args) => args.unstable_runMiddleware(dataStrategy);
163+
return async (args) => args.unstable_runClientMiddleware(dataStrategy);
164164
}
165165

166166
export function getSingleFetchDataStrategyImpl(

packages/react-router/lib/router/router.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5565,10 +5565,10 @@ async function callDataStrategyImpl(
55655565
context: scopedContext,
55665566
matches,
55675567
};
5568-
let unstable_runMiddleware = isStaticHandler
5568+
let unstable_runClientMiddleware = isStaticHandler
55695569
? () => {
55705570
throw new Error(
5571-
"You cannot call `unstable_runMiddleware()` from a static handler " +
5571+
"You cannot call `unstable_runClientMiddleware()` from a static handler " +
55725572
"`dataStrategy`. Middleware is run outside of `dataStrategy` during " +
55735573
"SSR in order to bubble up the Response. You can enable middleware " +
55745574
"via the `respond` API in `query`/`queryRoute`"
@@ -5588,10 +5588,10 @@ async function callDataStrategyImpl(
55885588
cb({
55895589
...typedDataStrategyArgs,
55905590
fetcherKey,
5591-
unstable_runMiddleware: () => {
5591+
unstable_runClientMiddleware: () => {
55925592
throw new Error(
5593-
"Cannot call `unstable_runMiddleware()` from within an " +
5594-
"`unstable_runMiddleware` handler"
5593+
"Cannot call `unstable_runClientMiddleware()` from within an " +
5594+
"`unstable_runClientMiddleware` handler"
55955595
);
55965596
},
55975597
}),
@@ -5604,7 +5604,7 @@ async function callDataStrategyImpl(
56045604
let results = await dataStrategyImpl({
56055605
...dataStrategyArgs,
56065606
fetcherKey,
5607-
unstable_runMiddleware,
5607+
unstable_runClientMiddleware,
56085608
});
56095609

56105610
// Wait for all routes to load here but swallow the error since we want

packages/react-router/lib/router/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ export interface DataStrategyMatch
361361
export interface DataStrategyFunctionArgs<Context = DefaultContext>
362362
extends DataFunctionArgs<Context> {
363363
matches: DataStrategyMatch[];
364-
unstable_runMiddleware: (
364+
unstable_runClientMiddleware: (
365365
cb: DataStrategyFunction<Context>
366366
) => Promise<Record<string, DataStrategyResult>>;
367367
fetcherKey: string | null;

0 commit comments

Comments
 (0)