import { put , select } from 'redux-saga/effects' ; import { RootState } from '../types' ; import { SearchRequest , searchRequestContinuous } from '../actions/search' ; import { ToggleSearchActive } from '../actions/updateValue' ; import { CancelNextSearch , cancelNextSearch } from '../actions/scheduler' ; export function * toggleSearchActive ( action ) { const searchingActive = yield select ( ( state ) => state . searchingActive ) ; if ( searchingActive ) { yield put < SearchRequest > ( searchRequestContinuous ( ) ) ; } else { yield put < CancelNextSearch > ( cancelNextSearch ( ) ) ; } }