Skip to content

Commit

Permalink
Add check for undefined data-value attribute in LogLevelSelect.
Browse files Browse the repository at this point in the history
  • Loading branch information
junhaoliao committed Oct 1, 2024
1 parent d7e1352 commit a8e9147
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ const LogLevelSelect = () => {

const handleOptionClick = useCallback((ev: React.MouseEvent) => {
const currentTarget = ev.currentTarget as HTMLElement;
if ("undefined" === typeof currentTarget.dataset.value) {
console.error("Unexpected undefined value for \"data-value\" attribute");

return;
}

const selectedValue = Number(currentTarget.dataset.value);
setSelectedLogLevels(range({begin: selectedValue, end: 1 + MAX_LOG_LEVEL}));
}, []);
Expand Down

0 comments on commit a8e9147

Please sign in to comment.