-
Notifications
You must be signed in to change notification settings - Fork 4.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
Dataviews: Extract to dedicated bundled package #56721
Conversation
Size Change: +280 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
01a7ac3
to
4e75979
Compare
@@ -12,7 +12,7 @@ import { __ } from '@wordpress/i18n'; | |||
/** | |||
* Internal dependencies | |||
*/ | |||
import { unlock } from '../../lock-unlock'; |
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.
Taking this PR as opportunity to organize the code a bit. What would you think of the following src
tree?
- actions
- view.js
- item.js
- filters
- index.js (was filters.js before)
- add.js
- reset.js
- summary.js
- layouts
- grid.js
- list.js
- table.js
- utils
- use-debounced-input.js
- constants.js
- dataviews.js
- index.js
- pagination.js
- search.js
- style.scss
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 planning to reorganise, but in the follow ups because of the many iterations right now. Is that a blocker for you in 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.
Is that a blocker for you in this PR?
Not at all! Just thought it'd be nice given the situation, but I understand your concern about this PR's velocity. Let's revisit after merging if you feel this would take a bit longer to agree upon.
abb04dd
to
d35ebe4
Compare
OPERATOR_IN, | ||
LAYOUT_GRID, | ||
LAYOUT_TABLE, | ||
} from '@wordpress/dataviews'; |
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.
Personally, I'm not a big fan of exporting constants from package but I can live with it for now.
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.
There are a few things here:
- The string constants can be removed DataViews: do not export strings constants #56754
- The
VIEWS_LAYOUT
is used for two things- Detect supports, which also can be removed if we go with this API for the list view/preview DataViews: iterate on list view #56746
- Use the icons in the sidebar. What do we do with this one? Export the icons directly or provide a utility such as
getIconForViewType( viewType )
?
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.
Really cool, it shows that we did good work so far to keep the code independent.
What?
Part of: #55083
This PR extracts DataViews to a dedicated bundled package. Since there are many iterations on the feature it would be good to land the first version and refine later. By refine I mean exposing some APIs like
getLayout
, possibly create a store, etc..Testing Instructions