diff --git a/frontend/src/pages/Channels.tsx b/frontend/src/pages/Channels.tsx index 9cd0dc6f..0dbe1dc5 100644 --- a/frontend/src/pages/Channels.tsx +++ b/frontend/src/pages/Channels.tsx @@ -54,7 +54,8 @@ const Channels = () => { const [channelListResponse, setChannelListResponse] = useState(); const [showAddForm, setShowAddForm] = useState(false); - const [refresh, setRefresh] = useState(false); + const [refresh, setRefresh] = useState(true); + const [showNotification, setShowNotification] = useState(false); const [channelsToSubscribeTo, setChannelsToSubscribeTo] = useState(''); const channels = channelListResponse?.data; @@ -64,12 +65,16 @@ const Channels = () => { useEffect(() => { (async () => { - const channelListResponse = await loadChannelList( - currentPage, - userConfig.config.show_subed_only, - ); + if (refresh) { + const channelListResponse = await loadChannelList( + currentPage, + userConfig.config.show_subed_only, + ); - setChannelListResponse(channelListResponse); + setChannelListResponse(channelListResponse); + setShowNotification(false); + setRefresh(false); + } })(); }, [refresh, userConfig.config.show_subed_only, currentPage, pagination?.current_page]); @@ -124,7 +129,15 @@ const Channels = () => { )} - + { + if (!isDone) { + setRefresh(true); + } + }} + />
diff --git a/frontend/src/pages/Playlists.tsx b/frontend/src/pages/Playlists.tsx index e1bb8e50..4edc4b7f 100644 --- a/frontend/src/pages/Playlists.tsx +++ b/frontend/src/pages/Playlists.tsx @@ -17,6 +17,7 @@ import ScrollToTopOnNavigate from '../components/ScrollToTop'; import Button from '../components/Button'; import useIsAdmin from '../functions/useIsAdmin'; import { useUserConfigStore } from '../stores/UserConfigStore'; +import Notifications from '../components/Notifications'; export type PlaylistEntryType = { youtube_id: string; @@ -39,6 +40,7 @@ const Playlists = () => { const [showAddForm, setShowAddForm] = useState(false); const [refresh, setRefresh] = useState(false); + const [showNotification, setShowNotification] = useState(false); const [playlistsToAddText, setPlaylistsToAddText] = useState(''); const [customPlaylistsToAddText, setCustomPlaylistsToAddText] = useState(''); @@ -61,6 +63,7 @@ const Playlists = () => { setPlaylistReponse(playlist); setRefresh(false); + setShowNotification(false); })(); // eslint-disable-next-line react-hooks/exhaustive-deps }, [refresh, userConfig.config.show_subed_only, currentPage, pagination?.current_page]); @@ -103,7 +106,7 @@ const Playlists = () => { type="submit" onClick={async () => { await updateBulkPlaylistSubscriptions(playlistsToAddText, true); - setRefresh(true); + setShowNotification(true); }} />
@@ -135,7 +138,15 @@ const Playlists = () => { )}
-
+ { + if (!isDone) { + setRefresh(true); + } + }} + />