Skip to content

Conversation

@manudeli
Copy link
Collaborator

@manudeli manudeli commented Jun 1, 2024

In my opinion, to express development mode console error message, we should use process.env.NODE_ENV === 'development' to express development mode. because @tanstack/react-query-devtools also use process.env.NODE_ENV === 'development' and additionally, even for production app, process.env.NODE_ENV !== 'production' can be occurred. so I want to minimize opportunity to make this error message like @tanstack/react-query-devtools
https://github.com/TanStack/query/blob/main/packages/react-query-devtools/src/index.ts#L6

@vercel
Copy link

vercel bot commented Jun 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
query ⬜️ Ignored (Inspect) Visit Preview Jun 1, 2024 2:48pm

@nx-cloud
Copy link

nx-cloud bot commented Jun 1, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 90196fb. 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 1 target

Sent with 💌 from NxCloud.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 1, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 90196fb:

Sandbox Source
@tanstack/query-example-angular-basic Configuration
@tanstack/query-example-react-basic-typescript Configuration
@tanstack/query-example-solid-basic-typescript Configuration
@tanstack/query-example-svelte-basic Configuration
@tanstack/query-example-vue-basic Configuration

@codecov
Copy link

codecov bot commented Jun 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.34%. Comparing base (93674fe) to head (9592a5c).
Report is 165 commits behind head on main.

Current head 9592a5c differs from pull request most recent head 90196fb

Please upload reports for the commit 90196fb to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #7502       +/-   ##
===========================================
+ Coverage   41.42%   85.34%   +43.91%     
===========================================
  Files         184       23      -161     
  Lines        7331      307     -7024     
  Branches     1531       78     -1453     
===========================================
- Hits         3037      262     -2775     
+ Misses       3889       37     -3852     
+ Partials      405        8      -397     
Components Coverage Δ
@tanstack/angular-query-devtools-experimental ∅ <ø> (∅)
@tanstack/angular-query-experimental ∅ <ø> (∅)
@tanstack/eslint-plugin-query ∅ <ø> (∅)
@tanstack/query-async-storage-persister ∅ <ø> (∅)
@tanstack/query-broadcast-client-experimental ∅ <ø> (∅)
@tanstack/query-codemods ∅ <ø> (∅)
@tanstack/query-core ∅ <ø> (∅)
@tanstack/query-devtools ∅ <ø> (∅)
@tanstack/query-persist-client-core ∅ <ø> (∅)
@tanstack/query-sync-storage-persister ∅ <ø> (∅)
@tanstack/react-query 92.33% <ø> (-0.44%) ⬇️
@tanstack/react-query-devtools 10.71% <ø> (ø)
@tanstack/react-query-next-experimental ∅ <ø> (∅)
@tanstack/react-query-persist-client 100.00% <ø> (ø)
@tanstack/solid-query ∅ <ø> (∅)
@tanstack/solid-query-devtools ∅ <ø> (∅)
@tanstack/solid-query-persist-client ∅ <ø> (∅)
@tanstack/svelte-query ∅ <ø> (∅)
@tanstack/svelte-query-devtools ∅ <ø> (∅)
@tanstack/svelte-query-persist-client ∅ <ø> (∅)
@tanstack/vue-query ∅ <ø> (∅)
@tanstack/vue-query-devtools ∅ <ø> (∅)

@manudeli manudeli marked this pull request as ready for review June 1, 2024 10:19
@TkDodo
Copy link
Collaborator

TkDodo commented Jun 1, 2024

all places in query that want to report user config errors use process.env.NODE_ENV !== 'production' checks, for example:

if (process.env.NODE_ENV !== 'production') {
if (typeof options !== 'object' || Array.isArray(options)) {
throw new Error(
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object',
)
}
}

This is on purpose to also see these errors in test environments. For example, you might have your test runner configured to fail on console errors, so these messages are helpful there.

@TkDodo TkDodo closed this Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants