Skip to content
Merged
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
13 changes: 9 additions & 4 deletions src/stackflow/activities/sheets/TransferWalletLockJob.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Step = 'wallet_lock' | 'two_step_secret';

function TransferWalletLockJobContent() {
const { t } = useTranslation(["security", "transaction", "common"]);
const { pop, push } = useFlow();
const { pop, push, replace } = useFlow();
const { title } = useActivityParams<TransferWalletLockJobParams>();
const clipboard = useClipboard();
const toast = useToast();
Expand Down Expand Up @@ -110,7 +110,12 @@ function TransferWalletLockJobContent() {
return unsubscribe;
}, [txHash, selectedChain, currentWallet?.address]);

// 上链成功后 5 秒倒计时自动关闭
// Navigate back to home (replace entire stack)
const goToHome = useCallback(() => {
replace('MainTabsActivity', {}, { animate: true });
}, [replace]);

// 上链成功后 5 秒倒计时自动关闭,返回首页
useEffect(() => {
if (txStatus !== 'confirmed') {
setCountdown(null);
Expand All @@ -122,15 +127,15 @@ function TransferWalletLockJobContent() {
setCountdown((prev) => {
if (prev === null || prev <= 1) {
clearInterval(timer);
pop();
goToHome();
return null;
}
return prev - 1;
});
}, 1000);

return () => clearInterval(timer);
}, [txStatus, pop]);
}, [txStatus, goToHome]);

// Get chain config for explorer URL
const chainConfig = useMemo(() => {
Expand Down