diff --git a/src/helpers/hooks.ts b/src/helpers/hooks.ts index 29d6abb196d74d1bcd1ed126c500e91241fb3a9f..43e7110e25fa69e7058168c75be51f77c0dec720 100644 --- a/src/helpers/hooks.ts +++ b/src/helpers/hooks.ts @@ -1,4 +1,4 @@ -import { Dispatch, SetStateAction, useCallback, useEffect, useState } from 'react'; +import { Dispatch, SetStateAction, useEffect, useState } from 'react'; type StorageObject = typeof window.localStorage | typeof window.sessionStorage; // useStorage, useLocalStorage and useSessionStorage is taken from: @@ -14,8 +14,8 @@ function useStorage<ValueType>( key: string, defaultValue: ValueType, storageObject: StorageObject, -): [ValueType | undefined, Dispatch<SetStateAction<ValueType | undefined>>, () => void] { - const [value, setValue] = useState<ValueType | undefined>(() => { +): [ValueType, Dispatch<SetStateAction<ValueType>>] { + const [value, setValue] = useState<ValueType>(() => { const jsonValue = storageObject.getItem(key); if (jsonValue != null) return JSON.parse(jsonValue); return defaultValue; @@ -26,11 +26,7 @@ function useStorage<ValueType>( storageObject.setItem(key, JSON.stringify(value)); }, [key, value, storageObject]); - const remove = useCallback(() => { - setValue(undefined); - }, []); - - return [value, setValue, remove]; + return [value, setValue]; } /** diff --git a/src/pages/FeatsVsFixesPage/index.tsx b/src/pages/FeatsVsFixesPage/index.tsx index d00a16f0c1d4a3e5b14c7a191aacaeaca7da5795..9d112126e6273d861edbc414f7a9fecf233c8fcf 100644 --- a/src/pages/FeatsVsFixesPage/index.tsx +++ b/src/pages/FeatsVsFixesPage/index.tsx @@ -27,7 +27,7 @@ export default function FeatsVsFixesPage() { ]; for (let i = 0; i < authorData.length; i++) { - if (selectedAuthors?.[i]) { + if (selectedAuthors[i]) { featsFixesGraphData[0].val += authorData[i].feats; featsFixesGraphData[1].val += authorData[i].fixes; additionsDeletionsGraphData[0].val += authorData[i].additions; @@ -54,7 +54,7 @@ export default function FeatsVsFixesPage() { <div key={JSON.stringify(m)}> Person {i + 1} <Checkbox - checked={selectedAuthors?.[i]} + checked={selectedAuthors[i]} onChange={() => { if (!selectedAuthors) return; // selectedAuthors will never be undefined const tempList = [...selectedAuthors]; diff --git a/src/pages/TimePerIssueLabelPage/index.tsx b/src/pages/TimePerIssueLabelPage/index.tsx index 3b2f22e857d0141d1432382c0a04c7439020061d..dcf7c8cdd3aee9b5e83a06cf71ce101392aa750a 100644 --- a/src/pages/TimePerIssueLabelPage/index.tsx +++ b/src/pages/TimePerIssueLabelPage/index.tsx @@ -37,7 +37,6 @@ export default function TimePerIssueLabelPage() { useEffect(() => { // If allIssueData or selected is null, something is not selected and or the data is not if (allIssueData == null) return; - if (selected == null) return; // Find the average time used to close an issue with one of the selected labels const selectedArray = JSON.parse(selected);