Fix storage reload button

This commit is contained in:
Joshen Lim committed 2022-05-24 11:13:23 +08:00
1 parent 412e9b8db1
commit 6dd923656d
2 files changed
+23 -2

No files matched your search

@@ -17,6 +17,7 @@ import {
IconLoader,
Typography,
} from '@supabase/ui'
import { useStorageStore } from 'localStores/storageExplorer/StorageExplorerStore'
import { STORAGE_VIEWS, STORAGE_SORT_BY } from '../Storage.constants.ts'
const HeaderPathEdit = ({ loading, breadcrumbs, togglePathEdit }) => {
@@ -125,12 +126,16 @@ const FileExplorerHeader = ({
}) => {
const debounceDuration = 300
const [isEditingPath, setIsEditingPath] = useState(false)
const [isRefreshing, setIsRefreshing] = useState(false)
const [pathString, setPathString] = useState('')
const [searchString, setSearchString] = useState('')
const uploadButtonRef = useRef(null)
const previousBreadcrumbs = useRef(null)
const storageExplorerStore = useStorageStore()
const { refetchAllOpenedFolders } = storageExplorerStore
useEffect(() => {
if (itemSearchString) setSearchString(itemSearchString)
}, [])
@@ -198,6 +203,12 @@ const FileExplorerHeader = ({
onSelectBreadcrumb(columnIndex)
}
const refreshData = async () => {
setIsRefreshing(true)
await refetchAllOpenedFolders()
setIsRefreshing(false)
}
return (
<div
className="
@@ -267,6 +278,16 @@ const FileExplorerHeader = ({
{/* Actions */}
<div className="flex items-center space-x-4">
<div className="flex items-center space-x-1">
<Button
className="mr-2"
size="tiny"
icon={<IconRefreshCw />}
type="text"
loading={isRefreshing}
onClick={refreshData}
>
Reload
</Button>
<Dropdown
overlay={[
<Dropdown.RadioGroup key="viewOptions" value={view} onChange={onChangeView}>
@@ -270,8 +270,8 @@ const StorageExplorer = observer(({ bucket }) => {
ref={storageExplorerRef}
className="
bg-bg-primary-light dark:bg-bg-primary-dark
border border-panel-border-light dark:border-panel-border-dark
w-full h-full rounded-md flex flex-col"
border-panel-border-light dark:border-panel-border-dark flex
h-full w-full flex-col rounded-md border"
>
{selectedItems.length === 0 ? (
<FileExplorerHeader