如何订阅终极版,传奇的行动?

问题描述 投票:0回答:1

我有终极版 - 圣人的一个问题。不能管理订阅行动。我有这样的设置店面

import { createStore, applyMiddleware, compose } from "redux"
import createSagaMiddleware from "redux-saga"

import rootSaga from "../config/rootSaga"
import rootReducer from "../config/rootReducer"

const effects = []

let composeEnhancers = compose

if (process.env.NODE_ENV === "development") {
  composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ // eslint-disable-line no-underscore-dangle
}

const sagaMiddleware = createSagaMiddleware()
effects.push(sagaMiddleware)

const store = createStore(rootReducer, {}, composeEnhancers(applyMiddleware(...effects)))
sagaMiddleware.run(rootSaga)

export default store

貌似传奇中间件不起作用。我看到从我rootSaga CONSOLE.LOG但当Redux的作用正在发生的传奇不起作用

export default function* searchRootSaga() {
  console.log("searchRootSaga") // I see this on start
  yield all([fork(throttle, 100, SEARCH.GET.REQUEST, getSearchThis)])
}

export function* getSearchThis(action) { 
  console.log("getSearchThis") // I dont see this
  try {
    // const response = yield call(API.getSearch, query)
    const response = dummy_data

    yield put(getSearchSuccess(response))
  } catch (e) {
    yield put(getSearchFailure("Server Err"))
  }
}

反应开发工具显示SEARCH.GET.REQUEST行动,但传奇是行不通的。我做错了吗?

reactjs redux react-redux redux-saga
1个回答
2
投票

我想,油门是无阻塞的效果本身。所以,你不需要到餐桌它。尝试:

yield throttle(100, SEARCH.GET.REQUEST, getSearchThis)
© www.soinside.com 2019 - 2024. All rights reserved.