Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: legacy context usages #107

Merged
merged 1 commit into from
Dec 23, 2018
Merged

feat: legacy context usages #107

merged 1 commit into from
Dec 23, 2018

Conversation

cdoublev
Copy link
Contributor

@cdoublev cdoublev commented Dec 13, 2018

This is a raw PR to fix #101 . I did not take care of types, tests, or whatever.

You can test upgrading/downgrading from react-redux@v5.1.0 / to react-redux@v6.0.0 with the redux-first-router branch of this repository as a simple boilerplate and run npm run start:client or npm run start:dev or npm run start.

Copy link
Collaborator

@ScriptedAlchemy ScriptedAlchemy left a comment

Choose a reason for hiding this comment

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

Seems pretty solid, I’ll take a closer look tomorrow!

Don’t worry about it being raw, I’ll handle the types and anything. The fact that you showed me what needs to be done is more than enough! It’s my pleasure to build upon your solution. Big thank you for taking the time to help RFR

@cdoublev cdoublev mentioned this pull request Dec 17, 2018
@cdoublev cdoublev changed the title Remove context usages Remove legacy context usages Dec 17, 2018
@cdoublev cdoublev changed the title Remove legacy context usages Fix legacy context usages Dec 17, 2018
@mungojam
Copy link

It looks like this changes the API by introducing a new location prop to both Link components. Is that a new feature?

@cdoublev
Copy link
Contributor Author

cdoublev commented Dec 17, 2018

You're right that location should not be mixed in the public interface. It is replacing the pathname prop of <NavLink>, which was also not meant to be defined by the user. How would you hide them?

@ScriptedAlchemy
Copy link
Collaborator

this one seems a little more robust: https://github.com/faceyspacey/redux-first-router-link/pull/113/files

is there anything you'd want o to add to that PR?

@cdoublev
Copy link
Contributor Author

cdoublev commented Dec 21, 2018

Sure, you can merge it, in my opinion. But @mungojam made a relevant observation about giving pathname/location to <Link>/<NavLink> from state via props. Chances that a user would need to pass down a prop with those names are small but... who knows?

My opinion is to merge it because this risk already exist by mapping dispatch and pathname to props, and the only workarounds I found are:

  1. prefixing ownProps properties with an underscore but the risk would still remain (but smaller)
  2. accessing to store and storeState via static contextType = ReactReduxContext and this.context, but then you would have to implement shouldComponentUpdate and I thought it was not worth it.

@mungojam
Copy link

I wouldn't worry about my point if you don't think it's likely to affect people.

I'm not familiar enough with the library to know what all the parameters do, so it was more that I was checking if the API was intentionally changed in the PR or if that could be done in a separate release if it was an unrelated improvement

@ScriptedAlchemy
Copy link
Collaborator

Okay guys. Christmas time and I’m mobile. Merge this and automate release, yes or no?

Do we cater for legacy or is this a breaking change deserving of a major release?

@circlingthesun
Copy link

This shouldn't break legacy code as it just uses the regular react-redux API. My vote is for merge.

@ScriptedAlchemy
Copy link
Collaborator

As you wish! If automated releases don’t work I’ll remotely fix that. But I know I’ve fixed most repos now

@ScriptedAlchemy ScriptedAlchemy changed the title Fix legacy context usages fix: legacy context usages Dec 23, 2018
@ScriptedAlchemy
Copy link
Collaborator

Friendly reminder to use semantic-release commit conventions or use commitizen.

@cdoublev

@ScriptedAlchemy ScriptedAlchemy changed the title fix: legacy context usages feat: legacy context usages Dec 23, 2018
@ScriptedAlchemy ScriptedAlchemy merged commit 5a3f2bb into faceyspacey:master Dec 23, 2018
@ScriptedAlchemy
Copy link
Collaborator

Releasing as a feat minor bump to be safe. Don’t want the community blowing up if the next patch version automatically installs.

@ScriptedAlchemy
Copy link
Collaborator

🎉 This PR is included in version 2.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mungojam
Copy link

This shouldn't break legacy code as it just uses the regular react-redux API. My vote is for merge.

My mistake, I'm not used to functional components that have state and/or prop-types and/or flow and I can see now that location was added to the state, not the props of the component

I look forward to using this new release and removing my horrid new-old context adaptor :)

@cdoublev
Copy link
Contributor Author

this one seems a little more robust: https://github.com/faceyspacey/redux-first-router-link/ pull/113/files

is there anything you'd want o to add to that PR?

I was expecting #113 being merged instead of this PR, which was raw, as indicated in its first comment. I'm confused.

@GuillaumeCisco
Copy link
Contributor

I was expecting #113 too regarding the discussion (:

@ScriptedAlchemy
Copy link
Collaborator

ScriptedAlchemy commented Dec 24, 2018

Whoooops
Okay, i was on my phone and got confused. Can @GuillaumeCisco please pull from master and resolve the conflicts, I’m at work right now but ill totally merge in your PR. Glad i did a version bump now! Haha

So sorry guys, the holiday season has be in worse attention span than usual.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Legacy Context removed on react-redux@^6
5 participants