mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Call mutate after uploading an item completes
This commit is contained in:
parent
ad391fb4e6
commit
b5a1d8fb9f
3 changed files with 6 additions and 2 deletions
|
|
@ -127,7 +127,7 @@ export function HomeFeedContainer(): JSX.Element {
|
|||
})
|
||||
)
|
||||
|
||||
const { itemsPages, size, setSize, isValidating, performActionOnItem } =
|
||||
const { itemsPages, size, setSize, isValidating, performActionOnItem, mutate } =
|
||||
useGetLibraryItemsQuery(queryInputs)
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -560,6 +560,7 @@ export function HomeFeedContainer(): JSX.Element {
|
|||
<HomeFeedGrid
|
||||
items={libraryItems}
|
||||
actionHandler={handleCardAction}
|
||||
reloadItems={mutate}
|
||||
searchTerm={queryInputs.searchQuery}
|
||||
gridContainerRef={gridContainerRef}
|
||||
applySearchQuery={(searchQuery: string) => {
|
||||
|
|
@ -613,6 +614,7 @@ export function HomeFeedContainer(): JSX.Element {
|
|||
type HomeFeedContentProps = {
|
||||
items: LibraryItem[]
|
||||
searchTerm?: string
|
||||
reloadItems: () => void
|
||||
gridContainerRef: React.RefObject<HTMLDivElement>
|
||||
applySearchQuery: (searchQuery: string) => void
|
||||
hasMore: boolean
|
||||
|
|
@ -736,6 +738,7 @@ function HomeFeedGrid(props: HomeFeedContentProps): JSX.Element {
|
|||
}
|
||||
|
||||
setUploadingFiles([])
|
||||
props.reloadItems()
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -51,6 +51,5 @@ export async function uploadFileRequestMutation(
|
|||
if (error) {
|
||||
throw error
|
||||
}
|
||||
console.log("RESPONSE DATA: ", data)
|
||||
return output?.uploadFileRequest
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ type LibraryItemsQueryResponse = {
|
|||
size: number | ((_size: number) => number)
|
||||
) => Promise<unknown[] | undefined>
|
||||
performActionOnItem: (action: LibraryItemAction, item: LibraryItem) => void
|
||||
mutate: () => void
|
||||
}
|
||||
|
||||
type LibraryItemAction =
|
||||
|
|
@ -352,5 +353,6 @@ export function useGetLibraryItemsQuery({
|
|||
performActionOnItem,
|
||||
size,
|
||||
setSize,
|
||||
mutate
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue