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

Refactoring EditorAction #10894

Merged
merged 4 commits into from Oct 29, 2020
Merged

Refactoring EditorAction #10894

merged 4 commits into from Oct 29, 2020

Conversation

Rafi993
Copy link
Contributor

@Rafi993 Rafi993 commented Oct 18, 2020

What type of PR is this?

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Refactoring editor actions

  1. Removing nested ternary operators for improving readability
  2. Converting class component to functional component

Related Tickets & Documents

closes #10947

QA Instructions, Screenshots, Recordings

  1. Create a post and publish it
  2. Edit a post
  3. Convert a post to draft
  4. Create a new post and save it as a draft

Added tests?

  • yes
  • no, because they aren't needed
  • no, because I need help

Added to documentation?

  • docs.forem.com
  • readme
  • no documentation needed

@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Oct 18, 2020
@Rafi993
Copy link
Contributor Author

Rafi993 commented Oct 28, 2020

I think the code climate error might be a false positive.

Copy link
Contributor

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

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

Looking good @Rafi993. A small change request.


const { moreConfigShowing } = this.state;
const toggleMoreConfig = useCallback(
Copy link
Contributor

Choose a reason for hiding this comment

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

refactor (blocking): useCallback seems overkill here. For context, see When to useMemo and useCallback.

onConfigChange,
submitting,
} = this.props;
const v1 = version === 'v1';
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick (non-blocking): consider naming these isVersion1 and isVersion2.

@pr-triage pr-triage bot added PR: reviewed-changes-requested bot applied label for PR's where reviewer requests changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 28, 2020
@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: reviewed-changes-requested bot applied label for PR's where reviewer requests changes labels Oct 28, 2020
Copy link
Contributor

@nickytonline nickytonline left a comment

Choose a reason for hiding this comment

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

Tested this locally and it LGTM. 🚀

@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 28, 2020
@Rafi993
Copy link
Contributor Author

Rafi993 commented Oct 29, 2020

Tested this locally and it LGTM. 🚀

Thank you @nickytonline

@rhymes rhymes merged commit 52f2627 into forem:master Oct 29, 2020
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactoring EditorAction
3 participants