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

boundActionCreators warning should say to replace them with "actions" and also link to the upgrade docs for this #6825

Closed
marisamorby opened this issue Jul 27, 2018 · 5 comments · Fixed by #6908
Labels
good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change

Comments

@marisamorby
Copy link
Contributor

marisamorby commented Jul 27, 2018

boundActionCreators warning should say to replace them with "actions" and also link to the upgrade docs for this

@marisamorby marisamorby created this issue from a note in Gatsby v2 Release (To Do - v2 blockers) Jul 27, 2018
@marisamorby
Copy link
Contributor Author

marisamorby commented Jul 27, 2018

@KyleAMathews: I updated this from a card to an issue so that it could be moved into the appropriate sub-epic.

@gatsbyjs gatsbyjs deleted a comment from gatsbot bot Jul 31, 2018
@jlengstorf jlengstorf self-assigned this Jul 31, 2018
@jlengstorf jlengstorf added the type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change label Jul 31, 2018
@jlengstorf
Copy link
Contributor

We should link to https://next.gatsbyjs.org/docs/migrating-from-v1-to-v2/#rename-boundactioncreators-to-actions in the error message.

The error message is generated here:

function printDeprecationWarnings() {
const deprecatedApis = [`boundActionCreators`, `pathContext`]
const fixMap = {
boundActionCreators: `actions`,
pathContext: `pageContext`,
}
const deprecatedLocations = {}
deprecatedApis.forEach(api => (deprecatedLocations[api] = []))
glob
.sync(`{,!(node_modules|public)/**/}*.js`, { nodir: true })
.forEach(file => {
const fileText = fs.readFileSync(file)
const matchingApis = deprecatedApis.filter(
api => fileText.indexOf(api) !== -1
)
matchingApis.forEach(api => deprecatedLocations[api].push(file))
})
deprecatedApis.forEach(api => {
if (deprecatedLocations[api].length) {
console.log(
`%s %s %s %s`,
chalk.cyan(api),
chalk.yellow(`is deprecated. Use`),
chalk.cyan(fixMap[api]),
chalk.yellow(`instead. Check the following files:`)
)
console.log()
deprecatedLocations[api].forEach(file => console.log(file))
console.log()
}
})
}

I think we can modify it a bit:

    const fixMap = {
      boundActionCreators: {
        newName: `actions`,
        docsLink: `https://next.gatsbyjs.org/docs/migrating-from-v1-to-v2/#rename-boundactioncreators-to-actions`,
      },
      // ...
    }

And then update the print template to show that docs link as well.

This would be a great first issue for someone!

@jlengstorf jlengstorf added help wanted Issue with a clear description that the community can help with. good first issue Issue that doesn't require previous experience with Gatsby labels Jul 31, 2018
@jlengstorf jlengstorf removed their assignment Jul 31, 2018
@thefifthisa
Copy link
Contributor

Hi, I'm new here and I'd love to take this!

@jlengstorf
Copy link
Contributor

Yes! Thanks @thefifthisa! Let us know if you have questions or need a second set of eyes. 💪💜

@thefifthisa
Copy link
Contributor

@jlengstorf Just opened a PR! Please let me know what I need to change or if it's okay already.

Gatsby v2 Release automation moved this from To Do - v2 blockers to Done Aug 1, 2018
lanzoninicola added a commit to lanzoninicola/gatsby-source-google-sheets that referenced this issue Apr 7, 2021
The "boundActionCreators" API is deprecated and replaced with "action" as mentioned here: gatsbyjs/gatsby#6825. To avoid "breaking changes" for those still using GatsbyJS v1, I have not removed the boundActionCreators in the parameter list. It's up to you to make the final decision.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issue that doesn't require previous experience with Gatsby help wanted Issue with a clear description that the community can help with. type: maintenance An issue or pull request describing a change that isn't a bug, feature or documentation change
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants