-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass 'force' parameter for redirects #38640
Changes from 1 commit
fd2e5ba
b581952
2c37d59
838bdd9
cbf37c5
fd7cb06
51edb37
80cc170
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -467,6 +467,7 @@ function getRoutesManifest(): RoutesManifest { | |
(redirect.isPermanent | ||
? HTTP_STATUS_CODE.MOVED_PERMANENTLY_301 | ||
: HTTP_STATUS_CODE.FOUND_302), | ||
force: redirect.force, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following on previous comment - as Something along the lines of this: // pick fields we explicitly handle, and pass remaining ones as "platform specific" fields
const { fromPath, toPath, statusCode, isPermanent, ignoreCase, redirectInBrowser, ...platformSpecificFields } = redirect
// note that `redirectInBrowser` field will be unused - if that is `true` there is redirect mechanism in browser runtime to handle the redirects (regardless of value of this field we always want all redirects handled by "the server")
addRoute({
path: fromPath,
// [...] rest of the fields we already have here adjusting for the fact we destructured `redirect` already
// so we can omit `redirect.` from most things
// pass any unknown platform specific fields so platform adapter can use them
...platformSpecificFields
}) I think this change would also help with the somewhat related |
||
ignoreCase: redirect.ignoreCase, | ||
headers: BASE_HEADERS, | ||
}) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
force
is Netlify specific field - it has no meaning to Gatsby - it shouldn't be typed explicitly as this "type" of field is generally covered by[key: string]: any
below (as in it will accept any additional properties that might be used by specific platform