Remove redundant TODOs

This commit is contained in:
Tom Southall
2022-03-15 14:42:04 +00:00
parent ebacd8b6ef
commit aad534f187
6 changed files with 8 additions and 8 deletions

View File

@@ -86,6 +86,7 @@ const App = () => {
placeholder={placeholder}
plugins={[[recentSearchesPlugin, {ratio: 2, name: 'Recent', limit: maxItems}]]}
styles={autocompleteStyles}
text="bar"
typeahead={true}
Cancel={CancelButton}
Clear={ClearButton}

View File

@@ -8,7 +8,8 @@ import {
formatQuery
} from './containerEffects'
let inputRef = (value = '') => ( //TODO: Put in a beforeEach when blogging
//TODO: Put in a beforeEach
let inputRef = (value = '') => (
{
current: {
focus: vi.fn(),

View File

@@ -35,13 +35,14 @@ const limitResults = (groups, listboxProp, maxItems) => {
const groupCounts = []
let unassignedSlots = resultTotal < maxItems ? resultTotal : maxItems
while (unassignedSlots > 0) { // TODO: Use something better than a while loop
while (unassignedSlots > 0) {
groups = groups.map((group, i) => {
if (!groupCounts[i]) {
groupCounts[i] = Math.round(ratios[i] * ratioMultiplier)
if (groupCounts[i] > group.length) groupCounts[i] = group.length
unassignedSlots = unassignedSlots - groupCounts[i]
} else if (groupCounts[i] < group.length) {
}
else if (groupCounts[i] < group.length) {
unassignedSlots -= ++groupCounts[i]
}
return group
@@ -114,8 +115,6 @@ export const fetcher = (query, listbox, defaultListbox, minQueryLength, maxItems
return groups.flat()
})
// .catch(() => {throw('Something went wrong')})
//TODO Put a .catch here https://javascript.info/promise-error-handling
}
const useData = (query, isImmutable, listbox, defaultListbox, minQueryLength, maxItems) => {

View File

@@ -6,7 +6,7 @@ import { fetcher } from './useData'
import undef from '../../utils/undef'
import { fruits, vegetables, books } from '../../../data'
// TODO: This might be better tested in an integration test
// TODO: This would be better tested in an integration test
///////////////////////////////////////////
// Test Fetched data //

View File

@@ -4,7 +4,6 @@ import { describe, expect, test } from 'vitest'
import { StateContextProvider } from '../context/state.jsx'
import Item from './item.jsx'
// TODO: Create test helper files?
const customStyles = {
item: 'item-class',
highlightedItem: 'highlighted-item-class',

View File

@@ -19,7 +19,7 @@ const StateContextProvider = (props) => {
props: propsMinusChildren
})
useEffect(() => dispatch(setQuery(text)), [text]) // TODO: Is this needed?
useEffect(() => dispatch(setQuery(text)), [text])
return (
<StateContext.Provider