-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
fix: replace series function used to queue async callbacks #11485
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR
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 ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #11485 +/- ##
==========================================
+ Coverage 75.60% 75.66% +0.06%
==========================================
Files 194 194
Lines 5783 5773 -10
Branches 2275 2273 -2
==========================================
- Hits 4372 4368 -4
+ Misses 1364 1358 -6
Partials 47 47
☔ View full report in Codecov by Sentry. |
@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.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 theisRunning
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.