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

Fix(ReactVis): Stop Setting Refs On Stateless Components #867

Merged
merged 6 commits into from
Jul 11, 2018

Conversation

benshope
Copy link
Contributor

@benshope benshope commented Jul 10, 2018

00ffe61 tries to set the ref attribute on stateless components - which causes loads of console errors. This fix only sets the ref attribute on components which were previously receiving it.

#861

@benshope
Copy link
Contributor Author

@mcnuttandrew and should I overwrite the previous buggy patch or push a new one?

@mcnuttandrew
Copy link
Contributor

I like your fix! Is there a way to write a test about this so it doesn't happen again? (if not i'm not incredibly concerned, I think we'll get a similar bunch of people yelling about it)

You should always cut new patches! Our versioning isn't super fancy or branded, so in my view it's better to have something that is actively versioned rather than try to fix buggy versions. Version 1.10.2 here we come!!

@benshope
Copy link
Contributor Author

@mcnuttandrew great, thanks - and sorry about breaking things! Spying on console.error (or causing it to throw an error) during existing tests might cover this scenario and a number of other undesirable ones - let me try that - and possibly add the regression test to this PR

tests/setup.js Outdated
@@ -8,6 +8,9 @@ Object.keys(document.defaultView).forEach(function mapProperties(property) {
global[property] = document.defaultView[property];
}
});
console.error = (message) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this only works on React 16 for this specific bug, but it catches others

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like you are failing lint? Also if this starts getting too rabbit hole-y, maybe push the console.error stuff into a seperate PR so this bug fix can go out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea agreed, I'll remove this and ship it

@benshope benshope merged commit 1ab5cc7 into master Jul 11, 2018
@benshope benshope deleted the fix_stateless_ref_error branch July 11, 2018 10:20
ayarcohaila pushed a commit to ayarcohaila/react-vis that referenced this pull request Jun 30, 2021
* Fix(ReactVis): Ref On Stateless Component Error

* cleanup

* fix lint

* add regression test

* fix lint

* remove regression test
ayarcohaila added a commit to ayarcohaila/react-vis that referenced this pull request May 30, 2023
* Fix(ReactVis): Ref On Stateless Component Error

* cleanup

* fix lint

* add regression test

* fix lint

* remove regression test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants