-
-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select() function does not work with use-saga-reducer #29
Comments
Hi, thanks for reporting. if I add useEffect(() => {
stateRef.current = state;
}); right after @azmenak Would you take a look please? |
@dai-shi thank you for the quick response! I can confirm that adding that |
Closing this as I filed the issue in the upstream: azmenak/use-saga-reducer#1 |
Update: issue has been resolved in |
The problem:
Calling
yield select()
inside a saga always returns the initial state, and not the actual current state. I need to access the current state inside a saga function, is there a different way to do this or is this a bug that needs fixing?Steps to reproduce:
In examples/13_saga/src/store.ts, import
select
from redux-saga/effects:And change
delayedDecrementer()
to be:Now, open the app in the browser, click the plus button a few times so the count equals
3
(or any number > 0). Then click "-1 Delayed" button.What actually happens:
The console logs display the message
The count is: 0
.What should happen:
The console logs should show the actual count value before the decrement i.e.
The count is: 3
.The text was updated successfully, but these errors were encountered: