From ae5d47fc21e2b1025d1a95931dcdc6d21247048d Mon Sep 17 00:00:00 2001 From: Roland Date: Mon, 11 Mar 2024 17:47:27 -0600 Subject: [PATCH] Shortening refresh button for mobile. --- app/src/api.js | 7 ++++--- app/src/components/FileBrowser.js | 7 ++----- app/src/components/Files.js | 20 +++----------------- 3 files changed, 9 insertions(+), 25 deletions(-) diff --git a/app/src/api.js b/app/src/api.js index da3a838c..ad6f03ce 100644 --- a/app/src/api.js +++ b/app/src/api.js @@ -589,12 +589,13 @@ export async function filesSearch(offset, limit, searchStr, mimetypes, model, ta export async function refreshFiles(paths) { let response; - if (paths && paths.constructor === Array) { + if (Array.isArray(paths) && paths.length > 0) { + // Refresh user-selected files/directories only. const body = {paths}; - console.debug(`Refreshing: ${paths}`); + console.info(`Refreshing: ${paths}`); response = await apiPost(`${API_URI}/files/refresh`, body); } else { - console.debug(`Refreshing all files`); + console.info(`Refreshing all files`); response = await apiPost(`${API_URI}/files/refresh`); } return response; diff --git a/app/src/components/FileBrowser.js b/app/src/components/FileBrowser.js index 7c17a7c1..4fe3dcce 100644 --- a/app/src/components/FileBrowser.js +++ b/app/src/components/FileBrowser.js @@ -17,7 +17,7 @@ import {deleteFile, ignoreDirectory, makeDirectory, movePaths, renamePath, unign import _ from 'lodash'; import {SortableTable} from "./SortableTable"; import {useBrowseFiles, useMediaDirectory, useWROLMode} from "../hooks/customHooks"; -import {DirectoryRefreshButton, FileRowTagIcon, FilesRefreshButton} from "./Files"; +import {FileRowTagIcon, FilesRefreshButton} from "./Files"; import {FilePreviewContext} from "./FilePreview"; import {SettingsContext} from "../contexts/contexts"; @@ -217,10 +217,7 @@ export function FileBrowser() { const footer = - {selectedPathsCount ? - - : - } + { } } -export function FilesRefreshButton() { - const {refreshing, refreshingDirectory, wrolModeEnabled, loading, refreshFiles} = useRefresh(); - - return ; -} - -export function DirectoryRefreshButton({paths}) { +export function FilesRefreshButton({paths}) { const {refreshing, refreshingDirectory, wrolModeEnabled, loading, refreshFiles} = useRefresh(); return + ; }