-
Notifications
You must be signed in to change notification settings - Fork 16.6k
feat(listview): skeleton loading states for table and card collections #10606
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
Conversation
808d66e to
80451bf
Compare
80451bf to
a1f56a3
Compare
superset-frontend/package.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is an internal dependency for fetchMock. Installing this was necessary in order to mock blob responses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[optional] this would be an excellent comment to squeeze into the package.json if json supported comments. There are some hacky ways to add comments. https://coding.napolux.com/how-to-add-comments-to-package-json/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not in favor of hacking in json comments. This is installed under devDependencies and the git blame should be enough to trace the change back to this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package.json5 -- one can dream, right? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: use a class or a constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT: class or constant. double diamonds {{ ... }} are generally suboptimal as they get re-created on each render and also trigger re-render in PureComponents (are they still popular?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct, they were generally not favorable (though I'm not so sure anymore with the rise in popularity of functional components and React's move to async rendering). However, these components just end up rendering divs with some loading shimmer styles, they're about a simple/dumb as components get. It won't have a measurable impact on performance in this instance. I'll move them to emotion though for consistency with other components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can now add ListViewCard.test.jsx (and/or other *.test.(j|t)sx files next to the component file itself (in the same folder), to make it easier to find/manage, and make it easier to import anything from the ListViewCard.stories.jsx file that may be useful in scaffolding tests.
See: #10634
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine, but often people just use the named import of useEffect - I'm not sure if we have a pattern we want to follow/establish
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5px? Should probably also be based on gridUnit... which would normally be 4... so this seems a bit odd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might it be a little DRYer to have the conditional rendering loading && ( down here within ? Not sure if that would be easier or harder to interpret ¯\_(ツ)_/¯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I had something like that originally but found it quite hard to read. I think the slightly less DRYness is worth if for higher code readability. It's much easier to figure out "Am I dealing with the skeleton or the actual component" if the two are separate blocks of jsx.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+px?
Also, again not sure if this big value should be a % or vw value rather than hard-coded
Last but not least though, I'm wondering if these css calls are somehow memoized to use the same class, or if it's generating a bunch of them here, meaning we should do something outside the function. Hopefully this is fine, but maybe worth checking for a performance hit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure they're statically extracted and replaced with classnames, setting this up required changes to babel which would indicate static code analysis/transformation of some sort.
Also, emotion is advertised as a performant css-in-js solution, so I'd expect them to have heavily optimized this use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here's some literature around this, there's a section where they mention that by default everything is extracted into static styles using css vars where needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same px/gridUnit question. Sorry to beat a dead horse.
rusackas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good in general. Some nits/questions listed, but the main thing is that I'd like to see some form of CSS units on numeric values. Now that there's a DOCTYPE, we can't rely on quirks mode to assure that these numbers fall back to px
7eab290 to
62e2ba0
Compare
Nit: Adding a px unit
ebc420c to
329c6fd
Compare
Codecov Report
@@ Coverage Diff @@
## master #10606 +/- ##
==========================================
+ Coverage 64.26% 64.29% +0.02%
==========================================
Files 781 783 +2
Lines 36882 36935 +53
Branches 3499 3527 +28
==========================================
+ Hits 23704 23746 +42
- Misses 13069 13077 +8
- Partials 109 112 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
Impacts #8976 |
SUMMARY
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
ADDITIONAL INFORMATION
ENABLE_REACT_CRUD_VIEWSflag)