Skip to content
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 extra useQuery result frames #9599

Merged
merged 24 commits into from
Apr 18, 2022
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5a3f033
Added useQuery frame tests to show that there is an unneeded frame.
FritsvanCampen Mar 10, 2022
3d7fa34
Strengthen frame tests with expected NetworkStatus values.
benjamn Mar 22, 2022
7f98827
TODOs
benjamn Mar 21, 2022
6540b23
Call this.observable.setOptions when options change in useOptions.
benjamn Mar 22, 2022
a90922c
Fix lifecycle test extraneous results.
benjamn Mar 22, 2022
95a1749
Fix faulty skip tests.
benjamn Mar 22, 2022
9b03177
Improve mutation test timing robustness.
benjamn Apr 7, 2022
7e723db
Support WatchQueryOptions.fetchBlockingPromise.
benjamn Apr 14, 2022
7b80c93
Use fetchBlockingPromise when calling setOptions.
benjamn Apr 14, 2022
db0bd4b
Fix skip tests previously suffering from extraneous results.
benjamn Apr 14, 2022
85ae61f
Correct the frame test.
benjamn Apr 13, 2022
655fe74
Make the corrected frame test pass.
benjamn Apr 14, 2022
2101a72
Make other tests pass.
benjamn Apr 14, 2022
e94b545
Remove UNNEEDED_FRAME from useQuery tests.
benjamn Apr 14, 2022
d0265d4
Remove non-essential code (no tests fail).
benjamn Apr 14, 2022
a506feb
Use fetchBlockingPromise for initial useQuery request as well.
benjamn Apr 14, 2022
d047ab1
Decompose and reuse useUnblockFetchEffect helper function.
benjamn Apr 14, 2022
6033827
Silently discard blocked fetches after five seconds without useEffect.
benjamn Apr 14, 2022
7331572
Call this.observable.reobserve directly, instead of setOptions.
benjamn Apr 14, 2022
4ba569e
Bump bundlesize limit to 29.4kB (now 29.35kB).
benjamn Apr 14, 2022
b992e37
Reduce RenderPromises clutter in useQuery implementation.
benjamn Apr 15, 2022
c402dd4
Handle fetchBlockingPromise rejections more gracefully.
benjamn Apr 18, 2022
241f6ee
Basic tests of using options.fetchBlockingPromise directly.
benjamn Apr 18, 2022
58cab4e
Test fetchBlockingPromise prevents duplicate requests in <StrictMode>.
benjamn Apr 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix faulty skip tests.
  • Loading branch information
benjamn committed Apr 14, 2022
commit 95a1749658f88f2e3c397edd3cbeef39e4618ab5
18 changes: 8 additions & 10 deletions src/react/hoc/__tests__/queries/skip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -676,15 +676,10 @@ describe('[queries] skip', () => {
expect(this.props.skip).toBe(false);
expect(this.props.data!.loading).toBe(true);
expect(this.props.data.allPeople).toEqual(data.allPeople);
expect(ranQuery).toBe(1);
expect(ranQuery).toBe(2);
break;
case 6:
expect(this.props.skip).toBe(false);
expect(this.props.data!.loading).toBe(true);
expect(this.props.data.allPeople).toEqual(data.allPeople);
expect(ranQuery).toBe(2);
break;
case 7:
expect(this.props.data!.loading).toBe(false);
expect(this.props.data.allPeople).toEqual(nextData.allPeople);
expect(ranQuery).toBe(2);
Expand All @@ -696,13 +691,13 @@ describe('[queries] skip', () => {
this.props.data.refetch();
}, 10);
break;
case 8:
case 7:
expect(this.props.skip).toBe(false);
expect(this.props.data!.loading).toBe(true);
expect(this.props.data.allPeople).toEqual(nextData.allPeople);
expect(ranQuery).toBe(3);
break;
case 9:
case 8:
// The next batch of data has loaded.
expect(this.props.skip).toBe(false);
expect(this.props.data!.loading).toBe(false);
Expand Down Expand Up @@ -739,10 +734,13 @@ describe('[queries] skip', () => {
</ApolloProvider>
);

waitFor(() => expect(count).toEqual(9)).then(resolve, reject);
waitFor(() => expect(count).toEqual(8)).then(resolve, reject);
}));

it('removes the injected props if skip becomes true', async () => {
// This test might have value, but is currently broken (the count === 0 test
// is never hit, for example, because count++ happens the first time before
// componentDidUpdate is called), so we are skipping it for now.
it.skip('removes the injected props if skip becomes true', async () => {
let count = 0;
const query: DocumentNode = gql`
query people($first: Int) {
Expand Down