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

chore: bump major versions of client dependencies #529

Merged
merged 10 commits into from
Aug 11, 2023

Conversation

KhaledEmaraDev
Copy link
Contributor

@KhaledEmaraDev KhaledEmaraDev commented Jun 19, 2023

  1. Bump all minor and patch versions of all packages.
  2. Upgrade autoprefixer: Use .browserslistrc and delete .postcssrc add it to postcss.config.js . Install and add postcss-preset-env to postcss.config.js.
  3. Upgrade immutable: Explicitly convert all Arrays to Lists.
  4. Upgrae marked: Install marked-gfm-heading-id to support gfm option.
  5. Upgrade react-router:
    a. Remove exact.
    b. Use Routes instead of Switch.
    c. Import StaticRouter from react-router-dom/server.
    d. Use element instead of component.
    e. Use absolute paths instead of relative in Links.
    f. Convert Two Components to Functional React ones in order to use useLocation hook.
    g. Use isActive in className instead of activeClassName.
    h. Use Navigate instead of Redirect.
    i. Reset state once redirected.
  6. Upgrade react-transition-group:
    a. Use TransitionGroup and CSSTransition instead of ReactCSSTransitionGroup.
    b. Convert one component to a Functional React one to use forwardRef.
    c. Add nodeRef as part of the state to track DOM nodes for animation.
  7. Install typescript because it's a needed peer depenency of prettier-eslint-cli.

This change is Reviewable

Copy link
Contributor

@ahangarha ahangarha left a comment

Choose a reason for hiding this comment

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

Thanks for working on upgrading dependencies especially for transition one.

Please fix linter issues.

Also, please consider splitting changes into smaller and relevant commits. Pushing many changes in only one commit makes debugging and reviewing difficult. Many small and relevant commits are better. It helps to know the rationale behind a particular change.

@justin808
Copy link
Member

@KhaledEmaraDev what's left here?

@ahangarha
Copy link
Contributor

ahangarha commented Aug 1, 2023

Good work so far 👍🏾

I see two issues:

Deleting a comment in the classic rails page causes the following error in the browser console
image

Also, we still have this error from the past:
image

Let's fix this here in this PR.

Copy link
Contributor

@ahangarha ahangarha left a comment

Choose a reason for hiding this comment

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

Great work 👍🏾
Thanks to @KhaledEmaraDev for starting and @Yassa-hue for wrapping up.

To me, this PR is done.

I made two comments (which are not blocking)

Comment on lines 55 to 57
// `key` is a React-specific concept and is not mandatory for the
// purpose of this tutorial. if you're curious, see more here:
// http://facebook.github.io/react/docs/multiple-components.html#dynamic-children
Copy link
Contributor

Choose a reason for hiding this comment

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

Any React developer should know to include unique key to lists to avoid issues when interacting with them. We don't need to mention it here.

Comment on lines 76 to 77
// The 500 must correspond to the 0.5s in:
// client/app/bundles/comments/components/CommentBox/CommentBox.module.scss:6
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is an example of a good comment.
I would propose the same comment on the sass file too.

@ahangarha ahangarha marked this pull request as ready for review August 7, 2023 13:55
KhaledEmaraDev and others added 9 commits August 10, 2023 13:36
1. Bump all minor and patch versions of all packages.
2. Upgrade `autoprefixer`: Use `.browserslistrc` and delete `.postcssrc`
  Add it to `postcss.config.js`
  Install and add `postcss-preset-env` to `postcss.config.js`
3. Upgrade `immutable`: Explicitly convert all `Array`s to `List`s
4. Upgrae `marked`: Install `marked-gfm-heading-id` to support `gfm` opt
5. Upgrade `react-router`:
  a. Remove `exact`
  b. Use `Routes` instead of `Switch`.
  c. Import `StaticRouter` from `react-router-dom/server`.
  d. Use `element` instead of `component`
  e. Use absolute paths instead of relative in Links.
  f. Convert Two Components to Functional React ones in order to use
    `useLocation` hook.
  g. Use `isActive` in `className` instead of `activeClassName`.
  h. Use `Navigate` instead of `Redirect`.
  i. Reset state once redirected.
6. Upgrade `react-transition-group`:
  a. Use `TransitionGroup` and `CSSTransition` instead of
    `ReactCSSTransitionGroup`.
  b. Convert one component to a Functional React one to use `forwardRef`
  c. Add `nodeRef` as part of the state to track DOM nodes for animation
7. Install `typescript` because it's a needed peer depenency of
  `prettier-eslint-cli`

Signed-off-by: Khaled Emara <[email protected]>
This commit solve the warning of unexpected ref object provided for a div.
- Since we create the comment nodeRef in the CommentList component
  We don’t need it to be created during adding a comment.

- We shouldn’t change the props of a react component, It is not
  the best practice, So that this commit creates the nodeRef in the
  render function where it is used instead of the constructor function.
Copy link
Contributor

@ahangarha ahangarha left a comment

Choose a reason for hiding this comment

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

Good work 👍🏾

  1. After rebasing, we have a new page for stimulus. There, we still get the following warning message:
    image

  2. We had a new set of browserlist. After rebase, it is gone.

  3. There are some comments from my previous review. Maybe consider applying them with the next commits for wrapping this PR up.

Our only error is related to i18n, which comes from the past and can be fixed in a separate PR.

I don't see any other issues.

import { injectIntl } from 'react-intl';
import BaseComponent from 'libs/components/BaseComponent';
Copy link
Contributor

Choose a reason for hiding this comment

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

It's just a linting issue.

@@ -52,9 +52,6 @@ export default class CommentList extends BaseComponent {
const commentNodes = $$comments.map(($$comment, index) => {
const nodeRef = React.createRef(null);
return (
// `key` is a React-specific concept and is not mandatory for the
// purpose of this tutorial. if you're curious, see more here:
// http://facebook.github.io/react/docs/multiple-components.html#dynamic-children
<CSSTransition
key={$$comment.get('id') || index}
Copy link
Contributor

Choose a reason for hiding this comment

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

I am concerned that this is a good key. Though it works in our case I think it is better to make ids like comment_123.

Copy link
Contributor

@ahangarha ahangarha left a comment

Choose a reason for hiding this comment

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

LGTM 👍🏾

@justin808 justin808 merged commit 9d919d5 into shakacode:master Aug 11, 2023
3 checks passed
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.

4 participants