0

Hi guys I try to solve one bug. After click on button is timeinput sometimes empty. When I use delay() all is ok. But without I have empty input when I create new visitor.

export const visitListStartFetchAfterChange: Epic = (action$, store) =>
  action$
    .ofType(
      'VR.FILTER_BAR.PICK_DATES',
      'VR.FILTER_BAR.PICK_LOCATION',
      'VR.FILTER_BAR.PICK_STATUS_TAB',
      'VR.VISIT.DELETE.SUCCESS',
      'VR.FILTER_BAR.PICK_VISITOR',
      'VR.FILTER_BAR.CLEAR_VISITOR',
    )

    // .delay(2000)
    .filter(() => isFilterBarInitialized(pathToVrFilterBar(store.getState())))
    .mapTo(visitListFetch());

Without delay()

With delay

1 Answers1

0

Because the actions are dispatched asynchronous. So that when you execute this code, the store did not update yet. There are a few ways to handle that. Use redux thunk to wait for the execution of the action or react to the change of data in your child component.

Domino987
  • 8,475
  • 2
  • 15
  • 38