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

Modify function definitions #1217

Merged
merged 5 commits into from
Nov 29, 2023
Merged

Modify function definitions #1217

merged 5 commits into from
Nov 29, 2023

Conversation

Eddasol
Copy link
Contributor

@Eddasol Eddasol commented Nov 23, 2023

No description provided.

@Eddasol Eddasol added improvement Improvement to existing functionality frontend Frontend related functionality labels Nov 23, 2023
@Eddasol Eddasol self-assigned this Nov 23, 2023
@Eddasol Eddasol linked an issue Nov 23, 2023 that may be closed by this pull request
@Eddasol Eddasol changed the title Camel case Refactor function definitions Nov 23, 2023
@Eddasol Eddasol changed the title Refactor function definitions Modify function definitions Nov 23, 2023
Copy link
Contributor

@andchiind andchiind left a comment

Choose a reason for hiding this comment

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

Looks good otherwise

Copy link
Contributor

@andchiind andchiind left a comment

Choose a reason for hiding this comment

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

LGTM, the comment is very minor and can be ignored if you want, to be honest

@@ -51,9 +51,7 @@ export function RobotStatusSection() {
}, [enabledRobots, installationCode, switchSafeZoneStatus])

const getRobotDisplay = () => {
Copy link
Contributor

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 a function?

Suggested change
const getRobotDisplay = () => {
const robotDisplay = robots.map((robot) => <RobotStatusCard key={robot.id} robot={robot} />)

Copy link
Contributor

Choose a reason for hiding this comment

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

In general if a local function has no arguments (or if the argument values never change) and no side effects, then it can be safely made into a variable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are several like this so I suggest fixing them in separate PR

@@ -67,7 +67,7 @@ export function MissionMapView({ mission }: MissionProps) {
}

const findCurrentTaskOrder = useCallback(() => {
mission.tasks.forEach(function (task) {
mission.tasks.forEach((task) => {
if (task.status === TaskStatus.InProgress || task.status === TaskStatus.Paused) {
setCurrentTaskOrder(task.taskOrder)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to your PR, but this isn't necessarily safe. Sorry you can ignore this comment, this is moreso a reminder to myself :)

@Eddasol Eddasol merged commit 2b5ef83 into equinor:main Nov 29, 2023
7 checks passed
@Eddasol Eddasol deleted the camelCase branch November 29, 2023 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Frontend related functionality improvement Improvement to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mixed use of camelCase and PascalCase in typescript function names
2 participants