Skip to content

Commit

Permalink
Fix handleSwitch for Hold/Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
philogicae committed Sep 6, 2024
1 parent d6dcfa4 commit cf7f5be
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/components/pages/computing/NewInstancePage/cmp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,25 @@ export default function NewInstancePage({ mainRef }: PageProps) {
const handleCloseModal = useCallback(() => setSelectedModal(undefined), [])

const handleSwitchToNodeStream = useCallback(() => {
if (selectedNode !== node?.hash) {
if (!isBlockchainPAYGCompatible(blockchain))
handleConnect({ blockchain: BlockchainId.BASE })
handleSelectNode(selectedNode)
}

if (selectedNode !== node?.hash) handleSelectNode(selectedNode)

setSelectedModal(undefined)
}, [handleConnect, handleSelectNode, node, selectedNode])
}, [blockchain, handleConnect, handleSelectNode, node, selectedNode])

const handleSwitchToAutoHold = useCallback(() => {
if (node?.hash) {
handleConnect({ blockchain: BlockchainId.ETH })
setSelectedNode(undefined)
handleSelectNode(undefined)
}

if (blockchain != BlockchainId.ETH)
handleConnect({ blockchain: BlockchainId.ETH })

setSelectedModal(undefined)
}, [handleConnect, handleSelectNode, node])
}, [blockchain, handleConnect, handleSelectNode, node])

useEffect(() => {
if (!modalOpen) return
Expand Down

0 comments on commit cf7f5be

Please sign in to comment.