Double call when LOCATION_CHANGE
See original GitHub issueI wonder if it normal behaviour to work like this.
if i use one of saga effect, let say takeLatest
,
and i change location (may be, back and forward the page)
and saga now will take double dispatched action on takeLatest
if i do it again, change location saga will take triple of that action.
Example code
function* fetchHotel(action) {
// BUSINESS LOGIC
}
export function* hotelSaga() {
yield* takeLatest(SUBMIT_FILTER, fetchHotel);
}
export default [
hotelSaga,
];
Currently, i have to cancel manually like below code
function* fetchHotel(action) {
// BUSINESS LOGIC
}
function* fetchHotelWatcher() {
yield* takeLatest(SUBMIT_FILTER, fetchHotel)
}
export function* hotelSaga() {
const hotelWatcher = yield fork(fetchHotelWatcher);
yield take(LOCATION_CHANGE);
yield cancel(hotelWatcher);
}
export default [
hotelSaga,
];
So do you think it is normal? i feel like it is not intuitive. Or should it be in document at least? If yes, i will add them in to docs.
Issue Analytics
- State:
- Created 7 years ago
- Comments:15 (5 by maintainers)
Top Results From Across the Web
Why does OnLocationChanged called twice every second?
OnLocationChanged is called twice every second with a 15 millis gap. I could not find a way to reproduce this bug. It is...
Read more >JavaScript - on location changed event / on url changed event
In this short article, we would like to show how in JavaScript detect if page URL (location object) was changed. In JavaScript there...
Read more >LocationListener - Android Developers
Used for receiving notifications when the device location has changed. These methods are called when the listener has been registered with the ...
Read more >gssef troop meeting location change notification form
This form is submitted as a one-time meeting location change and does NOT include Troop Field Trips, other Troop Travel or. Camping. Troop...
Read more >Top 5 Ways to Fake Location on Find My Friends - iMyFone
This doesn't mean you need to leave your phone at home. ... Double Location is another tool that you can use to manipulate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@chaintng did you solve this eventually?
+1