Skip to content

Commit

Permalink
Fix race in validation of obAbort call in case of starting many ope…
Browse files Browse the repository at this point in the history
…rations by single `sample` (#450)

* Add test case

* More tests

* More tests

* Improve test

* Add broken test

* Use newer effector to get scopeBind with callback

* Add more complicated test

* Revert "Use newer effector to get scopeBind with callback"

This reverts commit 9deb103.

* Fix onAbort issue

* Size

* Fix race in validation of `obAbort` call in case of starting many operations by single `sample`

* Fix test in attach

Order is reversed because of flushQueue hack in call object mechanics
Does not really affects the user code, as all queries are called with desired parameters anyway

---------

Co-authored-by: AlexandrHoroshih <xad71rus@gmail.com>
  • Loading branch information
igorkamyshev and AlexandrHoroshih committed Mar 11, 2024
1 parent 2d539c2 commit 5c0f6d6
Show file tree
Hide file tree
Showing 6 changed files with 423 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/strong-starfishes-pretend.md
@@ -0,0 +1,5 @@
---
'@farfetched/core': patch
---

Fix race in validation of `obAbort` call in case of starting many operations by single `sample`
2 changes: 1 addition & 1 deletion packages/core/package.json
Expand Up @@ -41,7 +41,7 @@
"size-limit": [
{
"path": "./dist/core.js",
"limit": "15.9 kB"
"limit": "15.95 kB"
}
]
}
4 changes: 2 additions & 2 deletions packages/core/src/attach/__tests__/attach.query.test.ts
Expand Up @@ -222,7 +222,7 @@ describe('attach for query', () => {

expect(originalHandler).toBeCalledTimes(2);

expect(originalHandler.mock.calls[0][0].url).toBe('https://api.salo.com/1');
expect(originalHandler.mock.calls[1][0].url).toBe('https://api.salo.com/2');
expect(originalHandler.mock.calls[0][0].url).toBe('https://api.salo.com/2');
expect(originalHandler.mock.calls[1][0].url).toBe('https://api.salo.com/1');
});
});

0 comments on commit 5c0f6d6

Please sign in to comment.