question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Double call when LOCATION_CHANGE

See original GitHub issue

I 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:closed
  • Created 7 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
Gyvastiscommented, Apr 11, 2017

@chaintng did you solve this eventually?

6reactions
somghoshcommented, Jul 22, 2016

+1

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found