Manage useEffect deps properly

This commit is contained in:
Uku Taht 2024-11-14 17:39:47 +02:00
parent ebb5a46872
commit ed4ebee1c0
2 changed files with 2 additions and 2 deletions

View File

@ -6,7 +6,7 @@ function usePrevious<T>(value: T): T | undefined {
useEffect(() => {
// Update the ref with the current value after render
ref.current = value;
});
}, [value]);
// Return the previous value
return ref.current;

View File

@ -180,7 +180,7 @@ export default function SourceList() {
if (currentTab == 'all' && isRemovingFilter('channel')) {
setTab('channels')()
}
}, [query])
}, [query, currentTab])
function setTab(tab) {
return () => {