Skip to content
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

feat(gatsby): Add ignoreCase option for createRedirect and support it in client sid… #29714

Merged
merged 12 commits into from
Feb 25, 2021

Conversation

sidharthachatterjee
Copy link
Contributor

…e navigation

This is a breaking change for Gatsby v3

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 23, 2021
@pieh
Copy link
Contributor

pieh commented Feb 23, 2021

Also

/** @see https://www.gatsbyjs.org/docs/actions/#createRedirect */
createRedirect(
redirect: {
fromPath: string
isPermanent?: boolean
toPath: string
redirectInBrowser?: boolean
force?: boolean
statusCode?: number
[key: string]: unknown
},
plugin?: ActionPlugin
): void
will need addition

Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add test to production-runtime?

You'll need to add ignoreCase to the CREATE_REDIRECT action.

For my comment to work you will also need to do the following:

const browserRedirects = redirects
.filter(r => r.redirectInBrowser)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
.map(({ redirectInBrowser, isPermanent, ...rest }) => rest)

  const browserRedirects = redirects
    .filter(r => r.redirectInBrowser)
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    .map(({ redirectInBrowser, isPermanent, ignoreCase, fromPath, ...rest }) => {
      return {
        fromPath: ignoreCase ? fromPath.toLowerCase() : fromPath,
        ...rest,
      }
    })

packages/gatsby/cache-dir/navigation.js Outdated Show resolved Hide resolved
@wardpeet wardpeet added topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation) and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Feb 23, 2021
@sidharthachatterjee sidharthachatterjee force-pushed the sid/ch25594/add-ability-to-ignore-case-when-creating branch 2 times, most recently from 2a420b3 to d5d0544 Compare February 24, 2021 11:45
@sidharthachatterjee sidharthachatterjee force-pushed the sid/ch25594/add-ability-to-ignore-case-when-creating branch from b2b8cd4 to 6ab5519 Compare February 24, 2021 17:31
wardpeet
wardpeet previously approved these changes Feb 24, 2021
Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small nit about let & const but this looks 👍.
Let's see if tests pass

packages/gatsby/cache-dir/navigation.js Outdated Show resolved Hide resolved
wardpeet
wardpeet previously approved these changes Feb 24, 2021
wardpeet
wardpeet previously approved these changes Feb 24, 2021
Co-authored-by: Ward Peeters <ward@coding-tech.com>
@wardpeet wardpeet merged commit 09f58de into master Feb 25, 2021
@wardpeet wardpeet deleted the sid/ch25594/add-ability-to-ignore-case-when-creating branch February 25, 2021 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: frontend Relates to frontend issues (e.g. reach/router, gatsby-link, page-loading, asset-loading, navigation)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants