github-actions[bot] on master
Version Packages (compare)
Andarist on master
Make `Task` interface generic (… (compare)
yield createRequestInstance(); yield watchRequests(); all([fork(duck1), fork(duck2)]);
yield all([fork(duck1), fork(duck2)]);
Hello @everyone
We’re looking for React/React Native engineers to work as part of our community. We have multiple projects and missions, where you choose on what you want to work. There is no hiring process, so keep your resumate... it’s an open organisation, here only our work matter :)
StudioLabs is a 100% remote international company, originally founded in Paris, France. We help companies develop their applications by providing them skills of developers and designers from around the world. We believe in living a life of freedom, where freelancers can choose their missions.
Join our community here:http://bit.ly/2w2BHYO
Error: /Users/aleksandervognildburkow/Projects/redux-saga/packages/core/types/ts3.5/channels.test.ts:24:1
ERROR: 24:1 expect TypeScript@next: Expected an error on this line, but found none.
ERROR: 32:1 expect TypeScript@next: Expected an error on this line, but found none.
ERROR: 45:1 expect TypeScript@next: Expected an error on this line, but found none.
ERROR: 47:1 expect TypeScript@next: Expected an error on this line, but found none.
ERROR: 51:1 expect TypeScript@next: Expected an error on this line, but found none.
ERROR: 56:1 expect TypeScript@next: Expected an error on this line, but found none.
ERROR: 58:1 expect TypeScript@next: Expected an error on this line, but found none.
ERROR: 82:1 expect TypeScript@next: Expected an error on this line, but found none.
ERROR: 90:1 expect TypeScript@next: Expected an error on this line, but found none.
ERROR: 99:1 expect TypeScript@next: Expected an error on this line, but found none.
ERROR: 112:1 expect TypeScript@next: Expected an error on this line, but found none.
ERROR: 116:1 expect TypeScript@next: Expected an error on this line, but found none.
In order for the execution exception of an effect to not affect the whole, I created a wrapper function. For example, the following adds safety to each effect, which solves the problem.
But if my effect is very large, it is very time consuming and not elegant to manually increase the safety. I want to know if there is any way, such as a loop function to automatically add safety to each effect, which makes the code more beautiful.
import { call } from 'redux-saga/effects';
export function safe(sagaFn) {
return function* (action) {
try {
return yield call(sagaFn, action);
} catch (e) {
console.error('[react-demo | Saga Unhandled Exception] This error should be fixed or do some pre check in saga effects function.');
console.error(e);
}
};
}
function* mySaga() {
yield takeEvery('USER_FETCH', safe(fetchUserEffects));
yield takeEvery('TEST_SAGA', safe(testSagaEffects));
yield takeEvery('TEST_SAGA', safe(testSagaEffects2));
}
@aleksanb Just came across your message. Thanks for reaching out! The errors you were pointing out occurred because TS wasn't able to resolve some types and was using any
type as a replacement. So this was actually highly related to the issue I had.
As I said in the PR, I finally found a way to debug and fix it and the PR got merged into master :tada: . Unfortunately, it doesn't seem to work on @Andarist machine and he's unable to release, not sure why. If you want to give it a try 🤷♂️ .
const someresult = yield call(someTypedFunction)
to work, but that's blocked on typescript adding more support, right?
I guys, I'm struggling in finding a proper way to use saga in my app. For example I have a fetch action and a notification function to push notification when the fetch action failed or succeeded.
The question is where should I put UI-related logic like notification, confirmation modals, router redirection...? Should I put it right in the saga?
That doesn't seem to be a good choice for me because I want the app logic to be separated from UI logic. That way I can later use my app logic for mobile and other devices and the only thing I need is to rebuild the UI itself. Can someone tell me what is the best practice for saga? Thank you!