File tree Expand file tree Collapse file tree 3 files changed +12
-10
lines changed
packages/react-router/lib Expand file tree Collapse file tree 3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ import { createRequestInit } from "./data";
18
18
import type { AssetsManifest , EntryContext } from "./entry" ;
19
19
import { escapeHtml } from "./markup" ;
20
20
import invariant from "./invariant" ;
21
- import { SINGLE_FETCH_REDIRECT_STATUS } from "../../server-runtime/single-fetch" ;
22
21
import type { RouteModules } from "./routeModules" ;
23
22
import type { DataRouteMatch } from "../../context" ;
24
23
@@ -57,6 +56,13 @@ interface StreamTransferProps {
57
56
nonce ?: string ;
58
57
}
59
58
59
+ // We can't use a 3xx status or else the `fetch()` would follow the redirect.
60
+ // We need to communicate the redirect back as data so we can act on it in the
61
+ // client side router. We use a 202 to avoid any automatic caching we might
62
+ // get from a 200 since a "temporary" redirect should not be cached. This lets
63
+ // the user control cache behavior via Cache-Control
64
+ export const SINGLE_FETCH_REDIRECT_STATUS = 202 ;
65
+
60
66
// Some status codes are not permitted to have bodies, so we want to just
61
67
// treat those as "no data" instead of throwing an exception:
62
68
// https://datatracker.ietf.org/doc/html/rfc9110#name-informational-1xx
Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ import {
29
29
getSingleFetchRedirect ,
30
30
singleFetchAction ,
31
31
singleFetchLoaders ,
32
- SINGLE_FETCH_REDIRECT_STATUS ,
33
32
SERVER_NO_BODY_STATUS_CODES ,
34
33
} from "./single-fetch" ;
35
34
import { getDocumentHeaders } from "./headers" ;
@@ -38,7 +37,10 @@ import type {
38
37
SingleFetchResult ,
39
38
SingleFetchResults ,
40
39
} from "../dom/ssr/single-fetch" ;
41
- import { SingleFetchRedirectSymbol } from "../dom/ssr/single-fetch" ;
40
+ import {
41
+ SINGLE_FETCH_REDIRECT_STATUS ,
42
+ SingleFetchRedirectSymbol ,
43
+ } from "../dom/ssr/single-fetch" ;
42
44
import type { MiddlewareEnabled } from "../types/future" ;
43
45
44
46
export type RequestHandler = (
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import type {
20
20
} from "../dom/ssr/single-fetch" ;
21
21
import {
22
22
NO_BODY_STATUS_CODES ,
23
+ SINGLE_FETCH_REDIRECT_STATUS ,
23
24
SingleFetchRedirectSymbol ,
24
25
} from "../dom/ssr/single-fetch" ;
25
26
import type { AppLoadContext } from "./data" ;
@@ -28,13 +29,6 @@ import { ServerMode } from "./mode";
28
29
import { getDocumentHeaders } from "./headers" ;
29
30
import type { ServerBuild } from "./build" ;
30
31
31
- // We can't use a 3xx status or else the `fetch()` would follow the redirect.
32
- // We need to communicate the redirect back as data so we can act on it in the
33
- // client side router. We use a 202 to avoid any automatic caching we might
34
- // get from a 200 since a "temporary" redirect should not be cached. This lets
35
- // the user control cache behavior via Cache-Control
36
- export const SINGLE_FETCH_REDIRECT_STATUS = 202 ;
37
-
38
32
// Add 304 for server side - that is not included in the client side logic
39
33
// because the browser should fill those responses with the cached data
40
34
// https://datatracker.ietf.org/doc/html/rfc9110#name-304-not-modified
You can’t perform that action at this time.
0 commit comments