Tally UI

useDriverStatus

useDriverStatus reads a payment driver's live status and re-renders when it changes.

Import

import { useDriverStatus } from '@tallyui/components';

Usage

const { connection, reader } = useDriverStatus(driver);

It subscribes to driver.status$ with useSyncExternalStore. With no driver it returns { connection: 'disconnected', reader: null }. A driver whose get() builds a new but equal status on every call still yields the same snapshot, so the component does not re-render in a loop.

It follows WCPOS v2's use-driver-status.ts. v2's registry helpers are not ported: in TallyUI the host passes the driver.

Props

PropTypeDefaultDescription
driverPaymentDriver | null | undefinedrequiredThe driver to read; returns DriverStatus

On this page