我正在尝试使用Redux开发工具:
- Next.js 13(应用程序文件夹)
- Redux工具包
- 复仇 Saga
我遇到的问题是我不能查看状态。有时候,当我固定persisted state选项时,它会工作,而且工作得更多。我通常只会得到这样的结果:
我期待看到的是:
不过,我不认为这次行动会开两枪。
我的传奇:
import { all, call, put } from 'redux-saga/effects';
import { getProfileFetch } from '../../features/profile/profileSlice';
function* getProfileDataSaga() {
const res = yield call(() =>
fetch('http://localhost:3000/api/profile', {
next: { revalidate: 10 },
method: 'GET'
})
);
const profileData = yield res.json();
yield put(getProfileFetch(profileData));
}
function* profileSaga() {
yield all([call(getProfileDataSaga)]);
}
export default profileSaga;
我的店铺索引
import { configureStore } from '@reduxjs/toolkit';
import createSagaMiddleware from 'redux-saga';
import profileReducer from '../../features/profile/profileSlice';
import profileSaga from './sagas';
const sagaMiddleware = createSagaMiddleware();
const store = configureStore({
reducer: {
profile: profileReducer
},
middleware: [sagaMiddleware],
});
sagaMiddleware.run(profileSaga);
// Infer the `RootState` and `AppDispatch` types from the store itself
export type RootState = ReturnType<typeof store.getState>;
// Inferred type: {posts: PostsState, comments: CommentsState, users: UsersState}
export type AppDispatch = typeof store.dispatch;
export default store;
有什么想法吗?短暂性脑缺血
1条答案
按热度按时间qvtsj1bj1#
这是下一个bug,他们的内部路由器挂接到devtools中,并带有一个固定的id
1
,覆盖了正常的Redux示例。我想他们现在已经修复了这个问题-你能下一个更新吗?