Simplify comparisons with undefined
This commit is contained in:
@@ -13,7 +13,7 @@ export function AlertTableHeader({
|
|||||||
sortState?: InterpretedResultsSortState;
|
sortState?: InterpretedResultsSortState;
|
||||||
}) {
|
}) {
|
||||||
const sortClass = useCallback((): string => {
|
const sortClass = useCallback((): string => {
|
||||||
if (sortState !== undefined && sortState.sortBy === "alert-message") {
|
if (sortState?.sortBy === "alert-message") {
|
||||||
return sortState.sortDirection === SortDirection.asc
|
return sortState.sortDirection === SortDirection.asc
|
||||||
? "sort-asc"
|
? "sort-asc"
|
||||||
: "sort-desc";
|
: "sort-desc";
|
||||||
@@ -26,7 +26,7 @@ export function AlertTableHeader({
|
|||||||
| InterpretedResultsSortState
|
| InterpretedResultsSortState
|
||||||
| undefined => {
|
| undefined => {
|
||||||
const prevDirection =
|
const prevDirection =
|
||||||
sortState && sortState.sortBy === "alert-message"
|
sortState?.sortBy === "alert-message"
|
||||||
? sortState.sortDirection
|
? sortState.sortDirection
|
||||||
: undefined;
|
: undefined;
|
||||||
const nextDirection = nextSortDirection(prevDirection, true);
|
const nextDirection = nextSortDirection(prevDirection, true);
|
||||||
|
|||||||
Reference in New Issue
Block a user