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

docs(useQuery): Write a story that visually shows useQuery loading/error/success states #73600

Closed
wants to merge 2 commits into from

Conversation

ryan953
Copy link
Member

@ryan953 ryan953 commented Jul 1, 2024

There's always been some slight confusion, and lack of clear examples, when it comes to using isFetching and isLoading from react-query. Also we're not super consistent on the names when we create our own loading state variables, which just adds to the confusion...

So I made a story that illustrates a few examples where we "load" in data slowly enough to see the state changes happening. Turns out that checking both isFetching and isLoading is probably what we should do all the time. <Suspense> is also a killer feature to leverage.

SCR-20240701-lspr

@ryan953 ryan953 requested a review from a team July 1, 2024 20:08
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 1, 2024
Copy link

codecov bot commented Jul 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.02%. Comparing base (fe8da9b) to head (c070ae8).
Report is 2067 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #73600      +/-   ##
==========================================
+ Coverage   68.90%   78.02%   +9.12%     
==========================================
  Files        6638     6639       +1     
  Lines      296910   296912       +2     
  Branches    51133    51133              
==========================================
+ Hits       204589   231675   +27086     
+ Misses      85601    58960   -26641     
+ Partials     6720     6277     -443     
Files Coverage Δ
static/app/stories/storyBook.tsx 0.00% <ø> (ø)

... and 1463 files with indirect coverage changes

<Fragment>
<p>
It seems like you can get really far by checking BOTH{' '}
<code>isFetching || isLoading</code> when you are waiting for the first render,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I not sure we should encourage checking for isFetching || isLoading, since you'll lose the benefits of background refetches if you do so

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll make more examples!

@getsantry getsantry bot added the Stale label Aug 9, 2024
@getsantry
Copy link
Contributor

getsantry bot commented Aug 9, 2024

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot closed this Aug 17, 2024
@ryan953
Copy link
Member Author

ryan953 commented Aug 28, 2024

Relates to #76407

@github-actions github-actions bot locked and limited conversation to collaborators Sep 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Scope: Frontend Automatically applied to PRs that change frontend components Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants