question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor and internationalize `IssueEventListItem`

See original GitHub issue

This component could benefit from a refactoring similar to EventsScreen, where every event type would be handled by a dedicated method.

Instead of the big switch/case in render(), we could have something like this:

render() {
    const { repository, event } = this.props;
    const handler = camelCase(`handle_${event.event}`); // lodash's camelCase

    if (typeof this[handler] === 'function') {
      return this[handler](event, repository);
    }

    return null;
}

and implement handleReviewRequested(), handleLabeled(), etc.

We would then wrap strings with utils.t() to internationalize this component.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
machourcommented, Apr 27, 2018

I actually have to do this while migrating the Issue Screen to GraphQL

0reactions
bobbylemmcommented, Apr 30, 2020

@machour has this task been done now?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code refactoring | IntelliJ IDEA Documentation - JetBrains
IntelliJ IDEA refactoring source code features description: change signature, copy, extract constant, extract variable, inline, move, pull, rename, ...
Read more >
Refactoring source code in Visual Studio Code
Visual Studio Code supports refactoring operations (refactorings) such as Extract Method and Extract Variable to improve your code base from within your editor....
Read more >
A Field Study of Refactoring Challenges and Benefits
This paper presents a field study of refactoring benefits and challenges at Microsoft through three complementary study methods: a survey, semi-structured ...
Read more >
AWS Migration Hub Refactor Spaces is now integrated with ...
AWS Migration Hub Refactor Spaces automates the creation of application refactor environments so that customers do not need to build the AWS ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found