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 browsing by product tag #2796
Fix browsing by product tag #2796
Conversation
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.
Just a question and maybe remove the strange code comment?
@@ -114,6 +116,7 @@ const wrapComponent = (Comp) => ( | |||
componentDidMount() { | |||
window.addEventListener("resize", this.onWindowResize); | |||
this.onWindowResize(); | |||
this._isMounted = true; |
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.
What is prefacing this variable with an underscore supposed to indicate/accomplish?
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.
I prefixed that variable with an underscore to show that it's a custom implementation of the now deprecated ReactComponent.isMounted()
as advised in this official React post.
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.
Furthermore, it's consistent with the _unmounted
variable in imports/plugins/core/components/lib/composer/compose.js
.
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.
Great. Works for me.
@@ -259,11 +263,13 @@ const wrapComponent = (Comp) => ( | |||
this.setState({ attachedBodyListener: false }); | |||
} | |||
|
|||
// TODO: If this is a method of TagNavContainer, why is it, and many | |||
// others, declared as an arrow function? |
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.
I don't know if a TODO code comment is the best place to get a programming question answered.
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.
Let's make the variable naming consistent with the rest of the code base
This works and I would like to merge it but I don't know what's up with the underscored variables |
Resolves #2626.
This PR fixes a bug in the
marketplace
branch. The cause was that this app was executing a certain callback that doessetState
in a React component that had been unmounted. This caused an error to be thrown in the browser console.Test instructions
localhost:3000
.localhost:3000/tags/SUB_TAG
and click outside the navbar.