diff --git a/apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.spec.tsx b/apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.spec.tsx index a4673a2618..2f85806dfe 100644 --- a/apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.spec.tsx +++ b/apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.spec.tsx @@ -231,7 +231,8 @@ describe(DeploymentDetailTopBar.name, () => { const track = input?.analyticsTrack ?? vi.fn(); const deps = MockComponents(DEPENDENCIES, { useServices: vi.fn(() => ({ - analyticsService: { track } + analyticsService: { track }, + deploymentLocalStorage: { delete: vi.fn() } })) as unknown as typeof DEPENDENCIES.useServices, useLocalNotes: vi.fn(() => ({ getDeploymentName: input?.localNotes?.getDeploymentName ?? (() => null), diff --git a/apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.tsx b/apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.tsx index 827aaec20a..886bb407fc 100644 --- a/apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.tsx +++ b/apps/deploy-web/src/components/deployments/DeploymentDetailTopBar/DeploymentDetailTopBar.tsx @@ -73,7 +73,7 @@ export const DeploymentDetailTopBar: React.FunctionComponent = ({ leases, dependencies: d = DEPENDENCIES }) => { - const { analyticsService } = d.useServices(); + const { analyticsService, deploymentLocalStorage } = d.useServices(); const { changeDeploymentName, getDeploymentData, getDeploymentName } = d.useLocalNotes(); const { udenomToUsd } = d.usePricing(); const router = d.useRouter(); @@ -105,6 +105,8 @@ export const DeploymentDetailTopBar: React.FunctionComponent = ({ const message = TransactionMessageData.getCloseDeploymentMsg(address, deployment.dseq); const response = await wallet.signAndBroadcastTx([message]); if (response) { + deploymentLocalStorage.delete(address, deployment.dseq); + onDeploymentClose(); removeLeases(); loadDeploymentDetail(); diff --git a/apps/deploy-web/src/components/deployments/DeploymentList.tsx b/apps/deploy-web/src/components/deployments/DeploymentList.tsx index 5bfd393b39..a0dd79bd08 100644 --- a/apps/deploy-web/src/components/deployments/DeploymentList.tsx +++ b/apps/deploy-web/src/components/deployments/DeploymentList.tsx @@ -21,6 +21,7 @@ import { NextSeo } from "next-seo"; import { useLocalNotes } from "@src/components/LocalNoteManager"; import { LinkTo } from "@src/components/shared/LinkTo"; +import { useServices } from "@src/context/ServicesProvider"; import { useSettings } from "@src/context/SettingsProvider"; import { useWallet } from "@src/context/WalletProvider"; import { useListSelection } from "@src/hooks/useListSelection/useListSelection"; @@ -38,6 +39,7 @@ import { DeploymentListRow } from "./DeploymentListRow"; export const DeploymentList: React.FunctionComponent = () => { const { address, signAndBroadcastTx, isWalletLoaded, isWalletConnected } = useWallet(); + const { deploymentLocalStorage } = useServices(); const { data: providers, isFetching: isLoadingProviders } = useProviderList(); const { data: deployments, isFetching: isLoadingDeployments, refetch: getDeployments } = useDeploymentList(address, { enabled: false }); const [pageIndex, setPageIndex] = useState(0); @@ -119,6 +121,8 @@ export const DeploymentList: React.FunctionComponent = () => { const messages = selectedItemIds.map(dseq => TransactionMessageData.getCloseDeploymentMsg(address, `${dseq}`)); const response = await signAndBroadcastTx(messages); if (response) { + selectedItemIds.forEach(dseq => deploymentLocalStorage.delete(address, `${dseq}`)); + getDeployments(); clearSelection(); } diff --git a/apps/deploy-web/src/components/deployments/DeploymentListRow.tsx b/apps/deploy-web/src/components/deployments/DeploymentListRow.tsx index 66cb828ccd..92fa81b36c 100644 --- a/apps/deploy-web/src/components/deployments/DeploymentListRow.tsx +++ b/apps/deploy-web/src/components/deployments/DeploymentListRow.tsx @@ -60,7 +60,7 @@ type Props = { export const DeploymentListRow: React.FunctionComponent = ({ deployment, isSelectable, onSelectDeployment, checked, providers, refreshDeployments }) => { const router = useRouter(); - const { analyticsService } = useServices(); + const { analyticsService, deploymentLocalStorage } = useServices(); const [open, setOpen] = useState(false); const [isDepositingDeployment, setIsDepositingDeployment] = useState(false); const { changeDeploymentName, getDeploymentData } = useLocalNotes(); @@ -136,6 +136,8 @@ export const DeploymentListRow: React.FunctionComponent = ({ deployment, const message = TransactionMessageData.getCloseDeploymentMsg(address, deployment.dseq); const response = await signAndBroadcastTx([message]); if (response) { + deploymentLocalStorage.delete(address, deployment.dseq); + if (onSelectDeployment) { onSelectDeployment({ id: deployment.dseq, isShiftPressed: false }); }