fix: replace series function used to queue async callbacks#11485
Conversation
|
Hey @karlsander! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines. |
✅ Deploy Preview for react-navigation-example ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
This change seems to break unit tests. Can you take a look? |
|
I'm not sure exactly, but the test is failing on |
|
@karlsander Would you be able to merge main to your branch? The tests are passing on main |
|
I can see they succeed on the branch check CI, but when I clone |
|
Hey, @karlsander I've tried wrapping There's one thing I'm not 100% sure of. I had to remove |
|
The tests do technically pass, but I think only because the failure is not captured correctly, because I still get this in the logs I think |
|
@karlsander Hey I created a PR to test new tests for the series without distracting you if something went wrong 😄 I've used BTW we used your BTW_2.0 the old implementation of The |
I don't remember exactly, but I think in that case two async functions at the same time are queued correctly, but not 3+ (a situation that doesn't really happen in this usage anyway). |
|
@satya164 all looks green now, but I cannot merge because I don't have access |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11485 +/- ##
==========================================
+ Coverage 75.60% 75.67% +0.06%
==========================================
Files 194 194
Lines 5785 5775 -10
Branches 2276 2274 -2
==========================================
- Hits 4374 4370 -4
+ Misses 1364 1358 -6
Partials 47 47 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@adamgrzybowski @karlsander I guess that is safe to go? |
|
I think so, we are using it in our App without any issues found so far 🤞 https://github.com/Expensify/App/pull/25989/files |
|
We are also using the patch with success, would appreciate if we can get this merged. |
**Motivation** This function is used to ensure that all state change callbacks to sync the local browser history state run in series. The functions are async because `history.go` is not a synchronous function. I noticed that in chrome, the URL was updating to the previous url instead of the new one in some navigations and tracked it down to the fact that the `history.go` navigation takes longer than in other browsers. This function is supposed to mitigate that, but I believe it has a bug. The function will not properly return early, because the finally clause will still always run and immediately reset the `isRunning` state. Even after fixing this, the function didn't quite work right for queuing more than two callbacks. I have replaced the function with a simpler implementation that does the same task. **Test plan** Describe the **steps to test this change** so that a reviewer can verify it. Provide screenshots or videos if the change affects UI. The change must pass lint, typescript and tests. --------- Co-authored-by: Michał Osadnik <micosa97@gmail.com>
Motivation
This function is used to ensure that all state change callbacks to sync the local browser history state run in series. The functions are async because
history.gois not a synchronous function.I noticed that in chrome, the URL was updating to the previous url instead of the new one in some navigations and tracked it down to the fact that the
history.gonavigation takes longer than in other browsers. This function is supposed to mitigate that, but I believe it has a bug. The function will not properly return early, because the finally clause will still always run and immediately reset theisRunningstate. Even after fixing this, the function didn't quite work right for queuing more than two callbacks.I have replaced the function with a simpler implementation that does the same task.
Test plan
Describe the steps to test this change so that a reviewer can verify it. Provide screenshots or videos if the change affects UI.
The change must pass lint, typescript and tests.