Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const DeploymentDetailTopBar: React.FunctionComponent<Props> = ({
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();
Expand Down Expand Up @@ -105,6 +105,8 @@ export const DeploymentDetailTopBar: React.FunctionComponent<Props> = ({
const message = TransactionMessageData.getCloseDeploymentMsg(address, deployment.dseq);
const response = await wallet.signAndBroadcastTx([message]);
if (response) {
deploymentLocalStorage.delete(address, deployment.dseq);

onDeploymentClose();
removeLeases();
loadDeploymentDetail();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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);
Expand Down Expand Up @@ -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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ type Props = {

export const DeploymentListRow: React.FunctionComponent<Props> = ({ 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();
Expand Down Expand Up @@ -136,6 +136,8 @@ export const DeploymentListRow: React.FunctionComponent<Props> = ({ 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 });
}
Expand Down