-
Notifications
You must be signed in to change notification settings - Fork 313
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
refactor: Upgrade react and react-dom to v16.8 and refactor Avatar #1171
Conversation
Verified that @j3tan has signed the CLA. Thanks for the pull request! |
@@ -73,12 +73,7 @@ class Assignees extends React.Component<Props> { | |||
/> | |||
} | |||
> | |||
<AssigneeStatus |
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.
for whatever reason, the data-testid
in the wrapper.find
was returning both this top level function and the nested div
causing 2x the number of objects returned. moving the data-testid into the child component fixes that without impacting usage
@@ -164,10 +164,6 @@ describe('elements/content-sidebar/ContentSidebar', () => { | |||
}); | |||
|
|||
test('should set the state with the file and view and then call fetchMetadata', () => { | |||
wrapper = getWrapper(); |
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.
unnecessary due to beforeEach, also was causing a random failure
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 think the use of hooks in Avatar is a reasonable basic example of the feature. The additional arbitrary complexity and boilerplate introduced into the tests isn't very palatable, though.
Finally, chore
commits don't mix very well with breaking changes, since that scope doesn't usually trigger new releases. Consider using feat
, refactor
, etc., instead.
package.json
Outdated
@@ -175,7 +175,7 @@ | |||
"deepmerge": "^2.1.1", | |||
"draft-js": "^0.10.1", | |||
"enzyme": "3.8.0", | |||
"enzyme-adapter-react-16": "^1.10.0", | |||
"enzyme-adapter-react-16": "1.12.1", |
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.
Does this need to be pinned to this specific version?
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.
not fixed, can change this to ^
src/components/avatar/Avatar.js
Outdated
avatar = <UnknownUserAvatar className="avatar-icon" />; | ||
// Reset hasImageErrored state when avatarUrl changes | ||
useEffect(() => { | ||
if (hasImageErrored) { |
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.
Is this check necessary or should we just reset setHasImageErrored
to false whenever the url changes?
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.
good point. since this only fires when url changes, there should be no downside to just calling this always
yeah, actually just copied the previous react upgrade PR message, but I can update to |
BREAKING CHANGE: peerDep React requirement have been bumped higher
@@ -175,7 +175,7 @@ | |||
"deepmerge": "^2.1.1", | |||
"draft-js": "^0.10.1", | |||
"enzyme": "3.8.0", | |||
"enzyme-adapter-react-16": "^1.10.0", | |||
"enzyme-adapter-react-16": "^1.12.1", | |||
"enzyme-to-json": "^3.3.4", | |||
"eslint": "^4.19.1", |
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.
Has FTL discussed adding the lint plugin for hooks?
https://www.npmjs.com/package/eslint-plugin-react-hooks
https://reactjs.org/docs/hooks-overview.html#rules-of-hooks
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.
yes, we will be adding this plugin. I'll discuss it at the next FTL meeting but it'll be an update to @box/frontend
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.
LGTM. Thanks for taking the time to work this out, @j3tan.
BREAKING CHANGE: peerDep React requirement have been bumped higher