fix: spdv-973
This commit is contained in:
@@ -121,6 +121,10 @@ export function FileItem({
|
||||
isMountedRef.current = true
|
||||
|
||||
const getStamps = async () => {
|
||||
if (!beeApi) {
|
||||
return
|
||||
}
|
||||
|
||||
const stamps = await getUsableStamps(beeApi)
|
||||
const driveStamp = stamps.find(s =>
|
||||
drives.some(d => d.batchId.toString() === s.batchID.toString() && d.id === fileInfo.driveId),
|
||||
|
||||
@@ -172,6 +172,10 @@ export function InitialModal({
|
||||
|
||||
useEffect(() => {
|
||||
const getStamps = async () => {
|
||||
if (!beeApi) {
|
||||
return
|
||||
}
|
||||
|
||||
const stamps = await getUsableStamps(beeApi)
|
||||
|
||||
safeSetState(isMountedRef, setUsableStamps)([...stamps])
|
||||
|
||||
@@ -38,6 +38,10 @@ export function NotificationBar({ setErrorMessage }: NotificationBarProps): Reac
|
||||
let isMounted = true
|
||||
|
||||
const getStamps = async () => {
|
||||
if (!beeApi) {
|
||||
return
|
||||
}
|
||||
|
||||
const allStamps = await getUsableStamps(beeApi)
|
||||
const expiringStamps: PostageBatch[] = []
|
||||
const expiringDrives: DriveInfo[] = []
|
||||
|
||||
@@ -59,6 +59,10 @@ export function Sidebar({ setErrorMessage, loading }: SidebarProps): ReactElemen
|
||||
let isMounted = true
|
||||
|
||||
const getStamps = async () => {
|
||||
if (!beeApi) {
|
||||
return
|
||||
}
|
||||
|
||||
const stamps = await getUsableStamps(beeApi)
|
||||
|
||||
if (isMounted) {
|
||||
|
||||
@@ -55,6 +55,10 @@ export function useBulkActions({ listToRender, trackDownload, setErrorMessage }:
|
||||
isMountedRef.current = true
|
||||
|
||||
const getStamps = async () => {
|
||||
if (!beeApi) {
|
||||
return
|
||||
}
|
||||
|
||||
const stamps = await getUsableStamps(beeApi)
|
||||
const stampList = stamps.filter(s => drives.some(d => d.batchId.toString() === s.batchID.toString()))
|
||||
|
||||
|
||||
@@ -11,11 +11,7 @@ import React from 'react'
|
||||
import { getHumanReadableFileSize } from '../../../utils/file'
|
||||
import { ActionTag } from '../constants/transfers'
|
||||
|
||||
export const getUsableStamps = async (bee: Bee | null): Promise<PostageBatch[]> => {
|
||||
if (!bee) {
|
||||
return []
|
||||
}
|
||||
|
||||
export const getUsableStamps = async (bee: Bee): Promise<PostageBatch[]> => {
|
||||
try {
|
||||
return (await bee.getPostageBatches())
|
||||
.filter(s => s.usable)
|
||||
|
||||
Reference in New Issue
Block a user