-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
refactor: throw type error when skipToken
is present in suspense query
#8082
refactor: throw type error when skipToken
is present in suspense query
#8082
Conversation
☁️ Nx Cloud ReportCI is running/has finished running commands for commit f9aa558. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 2 targetsSent with 💌 from NxCloud. |
@TkDodo To implement this, I had no choice but to add a new overload type to |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8082 +/- ##
===========================================
+ Coverage 45.41% 81.89% +36.48%
===========================================
Files 200 26 -174
Lines 7456 359 -7097
Branches 1696 98 -1598
===========================================
- Hits 3386 294 -3092
+ Misses 3694 56 -3638
+ Partials 376 9 -367
|
don’t think so |
I believe this PR is ready for review, and I would appreciate your feedback.
|
This is great, although I think we may keep the console.errors for those projects not using Typescript 😭 |
skipToken
is present in suspense queryskipToken
is present in suspense query
sorry about the conflicts - can you fix them please? |
one more question: what happens if you pass options created
? |
perfect - can you add a test for that too please? Then I'll ship it 🚢 |
I have added test cases for queryOptions, infiniteQueryOptions! There are no test errors in the local environment, but errors occasionally occur during the GitHub CI process. I’m unsure what to do to fix this error. Could you please help me? @TkDodo Task logs: https://cloud.nx.app/logs/bCPDeKeWGE |
I’ve tried to stabilize the test in a different PR. It’s just flaky right now. |
Summary
related: #8078 (reply in thread)
I improve DX(developer experience) by displaying an error during TypeScript type checking to indicate that
skipToken
cannot be used in Suspense Query.Details
queryFn
in the options for Suspense Query.queryOptions
andinfiniteQueryOptions
.I removed the
skipToken
type from Suspense Query and modified the types as follows to display an error whenskipToken
is assigned.While it was a good attempt, I couldn't pass the options using
queryOptions
(because of the differing types), so I had no choice but to add a new overload for Suspense Query inqueryOptions
.