Skip to content

Commit 6c5f899

Browse files
committed
Rename with unstable
1 parent c10e842 commit 6c5f899

File tree

6 files changed

+37
-34
lines changed

6 files changed

+37
-34
lines changed

packages/react-router/__tests__/dom/data-browser-router-test.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2528,7 +2528,7 @@ function testDomRouter(
25282528
});
25292529

25302530
describe("call-site revalidation opt-out", () => {
2531-
it("accepts defaultShouldRevalidate on <Link> navigations", async () => {
2531+
it("accepts unstable_defaultShouldRevalidate on <Link> navigations", async () => {
25322532
let loaderDefer = createDeferred();
25332533

25342534
let router = createTestRouter(
@@ -2552,7 +2552,7 @@ function testDomRouter(
25522552
let navigation = useNavigation();
25532553
return (
25542554
<div>
2555-
<Link to="/?foo=bar" defaultShouldRevalidate={false}>
2555+
<Link to="/?foo=bar" unstable_defaultShouldRevalidate={false}>
25562556
Change Search Params
25572557
</Link>
25582558
<div id="output">
@@ -2598,7 +2598,7 @@ function testDomRouter(
25982598
`);
25992599
});
26002600

2601-
it("accepts defaultShouldRevalidate on setSearchParams navigations", async () => {
2601+
it("accepts unstable_defaultShouldRevalidate on setSearchParams navigations", async () => {
26022602
let loaderDefer = createDeferred();
26032603

26042604
let router = createTestRouter(
@@ -2626,7 +2626,7 @@ function testDomRouter(
26262626
<button
26272627
onClick={() =>
26282628
setSearchParams(new URLSearchParams([["foo", "bar"]]), {
2629-
defaultShouldRevalidate: false,
2629+
unstable_defaultShouldRevalidate: false,
26302630
})
26312631
}
26322632
>
@@ -2675,7 +2675,7 @@ function testDomRouter(
26752675
`);
26762676
});
26772677

2678-
it("accepts defaultShouldRevalidate on <Form method=post> navigations", async () => {
2678+
it("accepts unstable_defaultShouldRevalidate on <Form method=post> navigations", async () => {
26792679
let loaderDefer = createDeferred();
26802680
let actionDefer = createDeferred();
26812681

@@ -2701,7 +2701,7 @@ function testDomRouter(
27012701
let navigation = useNavigation();
27022702
return (
27032703
<div>
2704-
<Form method="post" defaultShouldRevalidate={false}>
2704+
<Form method="post" unstable_defaultShouldRevalidate={false}>
27052705
<input name="test" value="value" />
27062706
<button type="submit">Submit Form</button>
27072707
</Form>
@@ -2748,7 +2748,7 @@ function testDomRouter(
27482748
`);
27492749
});
27502750

2751-
it("accepts defaultShouldRevalidate on fetcher.submit", async () => {
2751+
it("accepts unstable_defaultShouldRevalidate on fetcher.submit", async () => {
27522752
let loaderDefer = createDeferred();
27532753
let actionDefer = createDeferred();
27542754

@@ -2780,7 +2780,7 @@ function testDomRouter(
27802780
{
27812781
method: "post",
27822782
action: "/",
2783-
defaultShouldRevalidate: false,
2783+
unstable_defaultShouldRevalidate: false,
27842784
},
27852785
)
27862786
}

packages/react-router/__tests__/router/should-revalidate-test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,7 +1251,7 @@ describe("shouldRevalidate", () => {
12511251
});
12521252

12531253
let A = await t.navigate("/?foo=bar", {
1254-
defaultShouldRevalidate: false,
1254+
unstable_defaultShouldRevalidate: false,
12551255
});
12561256

12571257
A.loaders.index.resolve("SHOULD NOT BE CALLED");
@@ -1290,7 +1290,7 @@ describe("shouldRevalidate", () => {
12901290
});
12911291

12921292
let A = await t.navigate("/?foo=bar", {
1293-
defaultShouldRevalidate: false,
1293+
unstable_defaultShouldRevalidate: false,
12941294
});
12951295

12961296
A.loaders.index.resolve("SHOULD NOT BE CALLED");
@@ -1345,7 +1345,7 @@ describe("shouldRevalidate", () => {
13451345
{
13461346
formMethod: "post",
13471347
formData: createFormData({}),
1348-
defaultShouldRevalidate: false,
1348+
unstable_defaultShouldRevalidate: false,
13491349
},
13501350
["fetch"],
13511351
);
@@ -1418,7 +1418,7 @@ describe("shouldRevalidate", () => {
14181418
{
14191419
formMethod: "post",
14201420
formData: createFormData({}),
1421-
defaultShouldRevalidate: false,
1421+
unstable_defaultShouldRevalidate: false,
14221422
},
14231423
["fetch"],
14241424
);
@@ -1483,7 +1483,7 @@ describe("shouldRevalidate", () => {
14831483
let B = await t.fetch("/fetch", actionKey, "index", {
14841484
formMethod: "post",
14851485
formData: createFormData({}),
1486-
defaultShouldRevalidate: false,
1486+
unstable_defaultShouldRevalidate: false,
14871487
});
14881488
t.shimHelper(B.loaders, "fetch", "loader", "fetch");
14891489

@@ -1552,7 +1552,7 @@ describe("shouldRevalidate", () => {
15521552
let B = await t.fetch("/fetch", actionKey, "index", {
15531553
formMethod: "post",
15541554
formData: createFormData({}),
1555-
defaultShouldRevalidate: false,
1555+
unstable_defaultShouldRevalidate: false,
15561556
});
15571557
t.shimHelper(B.loaders, "fetch", "loader", "fetch");
15581558

@@ -1623,7 +1623,7 @@ describe("shouldRevalidate", () => {
16231623
let B = await t.fetch("/fetch", actionKey, "index", {
16241624
formMethod: "post",
16251625
formData: createFormData({}),
1626-
defaultShouldRevalidate: false,
1626+
unstable_defaultShouldRevalidate: false,
16271627
});
16281628
t.shimHelper(B.loaders, "fetch", "loader", "fetch");
16291629

packages/react-router/lib/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export interface NavigateOptions {
155155
/** Enables a {@link https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API View Transition} for this navigation by wrapping the final state update in `document.startViewTransition()`. If you need to apply specific styles for this view transition, you will also need to leverage the {@link https://api.reactrouter.com/v7/functions/react_router.useViewTransitionState.html useViewTransitionState()} hook. */
156156
viewTransition?: boolean;
157157
/** Specifies the default revalidation behavior after this submission */
158-
defaultShouldRevalidate?: boolean;
158+
unstable_defaultShouldRevalidate?: boolean;
159159
}
160160

161161
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ interface SharedSubmitOptions {
204204
* By default (when not specified), loaders will revalidate according to the routers
205205
* standard revalidation behavior.
206206
*/
207-
defaultShouldRevalidate?: boolean;
207+
unstable_defaultShouldRevalidate?: boolean;
208208
}
209209

210210
/**

packages/react-router/lib/dom/lib.tsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,7 +1303,7 @@ export interface LinkProps
13031303
* By default (when not specified), loaders will revalidate according to the routers
13041304
* standard revalidation behavior.
13051305
*/
1306-
defaultShouldRevalidate?: boolean;
1306+
unstable_defaultShouldRevalidate?: boolean;
13071307
}
13081308

13091309
const ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
@@ -1352,7 +1352,7 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
13521352
to,
13531353
preventScrollReset,
13541354
viewTransition,
1355-
defaultShouldRevalidate,
1355+
unstable_defaultShouldRevalidate,
13561356
...rest
13571357
},
13581358
forwardedRef,
@@ -1408,7 +1408,7 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
14081408
preventScrollReset,
14091409
relative,
14101410
viewTransition,
1411-
defaultShouldRevalidate,
1411+
unstable_defaultShouldRevalidate,
14121412
});
14131413
function handleClick(
14141414
event: React.MouseEvent<HTMLAnchorElement, MouseEvent>,
@@ -1820,7 +1820,7 @@ interface SharedFormProps extends React.FormHTMLAttributes<HTMLFormElement> {
18201820
* By default (when not specified), loaders will revalidate according to the routers
18211821
* standard revalidation behavior.
18221822
*/
1823-
defaultShouldRevalidate?: boolean;
1823+
unstable_defaultShouldRevalidate?: boolean;
18241824
}
18251825

18261826
/**
@@ -1944,7 +1944,7 @@ type HTMLFormSubmitter = HTMLButtonElement | HTMLInputElement;
19441944
* @param {FormProps.replace} replace n/a
19451945
* @param {FormProps.state} state n/a
19461946
* @param {FormProps.viewTransition} viewTransition n/a
1947-
* @param {FormProps.defaultShouldRevalidate} defaultShouldRevalidate n/a
1947+
* @param {FormProps.unstable_defaultShouldRevalidate} unstable_defaultShouldRevalidate n/a
19481948
* @returns A progressively enhanced [`<form>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) component
19491949
*/
19501950
export const Form = React.forwardRef<HTMLFormElement, FormProps>(
@@ -1962,7 +1962,7 @@ export const Form = React.forwardRef<HTMLFormElement, FormProps>(
19621962
relative,
19631963
preventScrollReset,
19641964
viewTransition,
1965-
defaultShouldRevalidate,
1965+
unstable_defaultShouldRevalidate,
19661966
...props
19671967
},
19681968
forwardedRef,
@@ -1995,7 +1995,7 @@ export const Form = React.forwardRef<HTMLFormElement, FormProps>(
19951995
relative,
19961996
preventScrollReset,
19971997
viewTransition,
1998-
defaultShouldRevalidate,
1998+
unstable_defaultShouldRevalidate,
19991999
});
20002000
};
20012001

@@ -2211,7 +2211,7 @@ function useDataRouterState(hookName: DataRouterStateHook) {
22112211
* @param options.viewTransition Enables a [View Transition](https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API)
22122212
* for this navigation. To apply specific styles during the transition, see
22132213
* {@link useViewTransitionState}. Defaults to `false`.
2214-
* @param options.defaultShouldRevalidate Defaults to `true`
2214+
* @param options.unstable_defaultShouldRevalidate Defaults to `true`
22152215
* @returns A click handler function that can be used in a custom {@link Link} component.
22162216
*/
22172217
export function useLinkClickHandler<E extends Element = HTMLAnchorElement>(
@@ -2223,15 +2223,15 @@ export function useLinkClickHandler<E extends Element = HTMLAnchorElement>(
22232223
preventScrollReset,
22242224
relative,
22252225
viewTransition,
2226-
defaultShouldRevalidate,
2226+
unstable_defaultShouldRevalidate,
22272227
}: {
22282228
target?: React.HTMLAttributeAnchorTarget;
22292229
replace?: boolean;
22302230
state?: any;
22312231
preventScrollReset?: boolean;
22322232
relative?: RelativeRoutingType;
22332233
viewTransition?: boolean;
2234-
defaultShouldRevalidate?: boolean;
2234+
unstable_defaultShouldRevalidate?: boolean;
22352235
} = {},
22362236
): (event: React.MouseEvent<E, MouseEvent>) => void {
22372237
let navigate = useNavigate();
@@ -2256,7 +2256,7 @@ export function useLinkClickHandler<E extends Element = HTMLAnchorElement>(
22562256
preventScrollReset,
22572257
relative,
22582258
viewTransition,
2259-
defaultShouldRevalidate,
2259+
unstable_defaultShouldRevalidate,
22602260
});
22612261
}
22622262
},
@@ -2271,7 +2271,7 @@ export function useLinkClickHandler<E extends Element = HTMLAnchorElement>(
22712271
preventScrollReset,
22722272
relative,
22732273
viewTransition,
2274-
defaultShouldRevalidate,
2274+
unstable_defaultShouldRevalidate,
22752275
],
22762276
);
22772277
}
@@ -2590,7 +2590,8 @@ export function useSubmit(): SubmitFunction {
25902590
if (options.navigate === false) {
25912591
let key = options.fetcherKey || getUniqueFetcherId();
25922592
await router.fetch(key, currentRouteId, options.action || action, {
2593-
defaultShouldRevalidate: options.defaultShouldRevalidate,
2593+
unstable_defaultShouldRevalidate:
2594+
options.unstable_defaultShouldRevalidate,
25942595
preventScrollReset: options.preventScrollReset,
25952596
formData,
25962597
body,
@@ -2600,7 +2601,8 @@ export function useSubmit(): SubmitFunction {
26002601
});
26012602
} else {
26022603
await router.navigate(options.action || action, {
2603-
defaultShouldRevalidate: options.defaultShouldRevalidate,
2604+
unstable_defaultShouldRevalidate:
2605+
options.unstable_defaultShouldRevalidate,
26042606
preventScrollReset: options.preventScrollReset,
26052607
formData,
26062608
body,

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ type BaseNavigateOrFetchOptions = {
524524
preventScrollReset?: boolean;
525525
relative?: RelativeRoutingType;
526526
flushSync?: boolean;
527-
defaultShouldRevalidate?: boolean;
527+
unstable_defaultShouldRevalidate?: boolean;
528528
};
529529

530530
// Only allowed for navigations
@@ -1557,7 +1557,8 @@ export function createRouter(init: RouterInit): Router {
15571557
replace: opts && opts.replace,
15581558
enableViewTransition: opts && opts.viewTransition,
15591559
flushSync,
1560-
callSiteDefaultShouldRevalidate: opts && opts.defaultShouldRevalidate,
1560+
callSiteDefaultShouldRevalidate:
1561+
opts && opts.unstable_defaultShouldRevalidate,
15611562
});
15621563
}
15631564

@@ -2361,7 +2362,7 @@ export function createRouter(init: RouterInit): Router {
23612362
flushSync,
23622363
preventScrollReset,
23632364
submission,
2364-
opts && opts.defaultShouldRevalidate,
2365+
opts && opts.unstable_defaultShouldRevalidate,
23652366
);
23662367
return;
23672368
}

0 commit comments

Comments
 (0)