Clean up debug statements
This commit is contained in:
parent
28a1f7a78a
commit
f7d473f1ff
@ -103,43 +103,28 @@ const CollectionSearch = ({
|
|||||||
);
|
);
|
||||||
const [prevCollection, setPrevCollection] = useState(collection);
|
const [prevCollection, setPrevCollection] = useState(collection);
|
||||||
|
|
||||||
console.log('selectedCollectionIdx', selectedCollectionIdx);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (prevCollection !== collection) {
|
if (prevCollection !== collection) {
|
||||||
console.log(
|
|
||||||
'resetting to ',
|
|
||||||
getSelectedSelectionBasedOnProps(),
|
|
||||||
'collection',
|
|
||||||
collection,
|
|
||||||
'prev',
|
|
||||||
prevCollection,
|
|
||||||
);
|
|
||||||
setSelectedCollectionIdx(getSelectedSelectionBasedOnProps());
|
setSelectedCollectionIdx(getSelectedSelectionBasedOnProps());
|
||||||
}
|
}
|
||||||
setPrevCollection(collection);
|
setPrevCollection(collection);
|
||||||
}, [collection, getSelectedSelectionBasedOnProps, prevCollection]);
|
}, [collection, getSelectedSelectionBasedOnProps, prevCollection]);
|
||||||
|
|
||||||
const selectNextSuggestion = useCallback(() => {
|
const selectNextSuggestion = useCallback(() => {
|
||||||
console.log('selectNextSuggestion');
|
|
||||||
setSelectedCollectionIdx(Math.min(selectedCollectionIdx + 1, collections.length - 1));
|
setSelectedCollectionIdx(Math.min(selectedCollectionIdx + 1, collections.length - 1));
|
||||||
}, [collections, selectedCollectionIdx]);
|
}, [collections, selectedCollectionIdx]);
|
||||||
|
|
||||||
const selectPreviousSuggestion = useCallback(() => {
|
const selectPreviousSuggestion = useCallback(() => {
|
||||||
console.log('selectPreviousSuggestion');
|
|
||||||
setSelectedCollectionIdx(Math.max(selectedCollectionIdx - 1, -1));
|
setSelectedCollectionIdx(Math.max(selectedCollectionIdx - 1, -1));
|
||||||
}, [selectedCollectionIdx]);
|
}, [selectedCollectionIdx]);
|
||||||
|
|
||||||
const resetSelectedSuggestion = useCallback(() => {
|
const resetSelectedSuggestion = useCallback(() => {
|
||||||
console.log('resetSelectedSuggestion');
|
|
||||||
setSelectedCollectionIdx(-1);
|
setSelectedCollectionIdx(-1);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const submitSearch = useCallback(
|
const submitSearch = useCallback(
|
||||||
(index: number) => {
|
(index: number) => {
|
||||||
console.log('searching selectedCollectionIdx', index);
|
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
console.log(collections, index);
|
|
||||||
onSubmit(query, collections[index]?.name);
|
onSubmit(query, collections[index]?.name);
|
||||||
} else {
|
} else {
|
||||||
onSubmit(query);
|
onSubmit(query);
|
||||||
@ -199,7 +184,6 @@ const CollectionSearch = ({
|
|||||||
const handleSuggestionClick = useCallback(
|
const handleSuggestionClick = useCallback(
|
||||||
(event: MouseEvent, idx: number) => {
|
(event: MouseEvent, idx: number) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
console.log('clicked index', idx);
|
|
||||||
setSelectedCollectionIdx(idx);
|
setSelectedCollectionIdx(idx);
|
||||||
submitSearch(idx);
|
submitSearch(idx);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user