diff options
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/View/Payment.hs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/client/src/View/Payment.hs b/client/src/View/Payment.hs index ae20079..915cc18 100644 --- a/client/src/View/Payment.hs +++ b/client/src/View/Payment.hs @@ -6,6 +6,7 @@ module View.Payment import Data.Text (Text) import qualified Data.Text as T +import Data.Time.Clock (NominalDiffTime) import Prelude hiding (init) import Reflex.Dom (Dynamic, Event, MonadWidget, Reflex) import qualified Reflex.Dom as R @@ -47,10 +48,16 @@ widget paymentIn = do let searchPayments = getSearchPayments - (_headerOut_searchName header) + debouncedSearchName (_headerOut_searchFrequency header) payments + debouncedSearchNameEvt <- + R.debounce (0.5 :: NominalDiffTime) (R.updated $ _headerOut_searchName header) + + debouncedSearchName <- + R.holdDyn "" debouncedSearchNameEvt + header <- Header.widget $ HeaderIn { _headerIn_init = init , _headerIn_payments = payments @@ -70,8 +77,8 @@ widget paymentIn = do { _pagesIn_total = length <$> searchPayments , _pagesIn_perPage = paymentsPerPage , _pagesIn_reset = R.leftmost $ - [ fmap (const ()) . R.updated . _headerOut_searchName $ header - , fmap (const ()) . _headerOut_addPayment $ header + [ const () <$> debouncedSearchNameEvt + , const () <$> _headerOut_addPayment header ] } |