Skip to content

Commit

Permalink
GH-797 Fix accessing missing value
Browse files Browse the repository at this point in the history
There was an JS error when we tried to access the `contextid` data value
of a HTML button, if that button was not defined.
Fixed now by checking if the model button exists.
  • Loading branch information
davidszkiba committed Jan 24, 2025
1 parent 2778585 commit c199f55
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion amd/build/calculatescales.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/calculatescales.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion amd/src/calculatescales.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ const SELECTORS = {
export const init = () => {

const calculateButton = document.querySelector(SELECTORS.CALCULATEBUTTON);
if (!calculateButton) {
return;
}
const contextId = parseInt(calculateButton.dataset.contextid);
calculateButton.onclick = () => {
updateParameters(contextId);
Expand Down Expand Up @@ -88,4 +91,4 @@ export const init = () => {
const disableButton = () => {
document.querySelector(SELECTORS.CALCULATEBUTTON).setAttribute('disabled', true);
};
};
};

0 comments on commit c199f55

Please sign in to comment.