-
Notifications
You must be signed in to change notification settings - Fork 12
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
Modernise javascript #402
base: main
Are you sure you want to change the base?
Modernise javascript #402
Conversation
… != operator is used for non-strict inequality comparison. Here are a few reasons why you might prefer to use !== instead of !=: The !== operator checks both the value and the type of the operands, whereas the != operator performs type coercion, which can lead to unexpected results. By using !==, you ensure that the values being compared are of the same type, making your code more robust and less prone to errors.
… declared do not change
we did not need to separate the URL variable into a separate "separated" variable so i changed it to one variable to get and split the variable. also replaced some of the vars with const
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.
Thanks for bringing up this PR 👏🏽
I didn't get what exactly this chunk is doing but I am providing general feedback.
@@ -42,18 +42,22 @@ $( document ).on('turbolinks:load', function() { | |||
}); | |||
|
|||
// Check if filter needs to be applied | |||
if ((window._search != undefined) && (window._search.length > 0 )) { | |||
if ((window._search !== undefined) && (window._search.length > 0 )) { |
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.
Have you tested edge cases? AFAIK there is a difference between !=
and !==
. For example,
null != undefined // false
null !== undefined // true
function openRequestedPopup() { | ||
windowObjectReference = window.open(_scorecard_path, 'Scorecard', strWindowFeatures); | ||
} | ||
const openRequestedPopup = () => windowObjectReference = window.open(_scorecard_path, 'Scorecard', strWindowFeatures); |
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 windowObjectReference
used somewhere?
function refreshParent() { | ||
window.opener.location.reload(); | ||
} | ||
const refreshParent = () => window.opener.location.reload(); |
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 couldn't find its call. Could you please check if there is?
function openRequestedPopup(team_scorecards_path) { | ||
windowObjectReference = window.open(team_scorecards_path, 'Team Scorecards', strWindowFeatures); | ||
} | ||
const openRequestedPopup = (team_scorecards_path) => windowObjectReference = window.open(team_scorecards_path, 'Team Scorecards', strWindowFeatures); |
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 windowObjectReference used somewhere?
window.opener.location.reload(); | ||
} | ||
|
||
const refreshParent = () => window.opener.location.reload(); |
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 couldn't find its call. Could you please check if there is?
const url = window.location.href; | ||
const tail = url.substring(url.lastIndexOf('/') + 1); | ||
|
||
// Remove any query parameters from the segment | ||
const clean_tail = tail.substring(0, tail.lastIndexOf('?')); |
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.
It looks like the whole purpose of these lines are to clean up the url. In this case we should wrap it into one function. Please, take this code as an example only:
const url = window.location.href; | |
const tail = url.substring(url.lastIndexOf('/') + 1); | |
// Remove any query parameters from the segment | |
const clean_tail = tail.substring(0, tail.lastIndexOf('?')); | |
... | |
const url_tail_without_parameters = url => { | |
const tail = url.substring(url.lastIndexOf('/') + 1); | |
// Remove any query parameters from the segment | |
return tail.substring(0, tail.lastIndexOf('?')); | |
} | |
... | |
const clean_tail = url_tail_without_parameters(window.location.href); |
$("#hiddendescription").html(content); | ||
$("#team_data_set_description").css("height", $("#hiddendescription").outerHeight()); | ||
} catch (e) { | ||
|
||
console.error('An error occured.', e) |
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.
Dp we use some error monitoring service like BugSnag?
Pull Request Checklist
main
branch