Experiment: Content types single route and package#78059
Conversation
|
Size Change: -32 kB (-0.4%) Total Size: 7.92 MB 📦 View Changed
ℹ️ View Unchanged
|
a890bfa to
6f821a9
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
tyxla
left a comment
There was a problem hiding this comment.
LGTM 👍
A few things that need a follow-up (but are not blockers for the PR) are:
- Ensuring we clean the cache of the entity type in the other tab upon any changes
- Fixing the sticky footer
Thanks for this, great to see unification in a single package! Finally we can consolidate and remove a bunch of the duplication!
🚀
| <div className="content-types-tabs-wrapper"> | ||
| <Tabs.TabList> | ||
| <Tabs.Tab tabId="post-types"> | ||
| { __( 'Post Types' ) } | ||
| </Tabs.Tab> | ||
| <Tabs.Tab tabId="taxonomies"> | ||
| { __( 'Taxonomies' ) } | ||
| </Tabs.Tab> | ||
| </Tabs.TabList> | ||
| </div> |
There was a problem hiding this comment.
One of the issues we have here now is that if you make a relationship between a post type and taxonomy (say you do it in the taxonomy edit page), and you navigate to the post types tab, you don't see the relationship immediately.
Looks like we need a dispatch( coreStore ).invalidateResolution( 'getEntityRecords', [ 'postType', OTHER_ENTITY ] ) or something like that upon save.
| > | ||
| <Tabs | ||
| selectedTabId={ activeTab } | ||
| onSelect={ ( tabId: string ) => |
There was a problem hiding this comment.
Is this necessary? Looks like it could theoretically be null or undefined
| onSelect={ ( tabId: string ) => | |
| onSelect={ ( tabId ) => |
|
Flaky tests detected in 6f821a9. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/25499617480
|
| "@wordpress/route": "file:../../packages/route" | ||
| } | ||
| }, | ||
| "routes/post-types": { |
There was a problem hiding this comment.
A bug in npm CLI - npm/cli#5463 leaves these renamed entries in the lockfile which can cause problems moving forward.
There was a problem hiding this comment.
I have created #78109 to remove these stale entries.
|
FYI, the corrupt lockfile and the missing dep was caught via #75814. I will try to create a PR to npm CLI to fix the bug. |
…78109) Removes four extraneous workspace entries left in package-lock.json by #78059 (packages/user-post-types, packages/user-taxonomies, routes/post-types, routes/taxonomies) and adds the missing @wordpress/base-styles dependency to the new @wordpress/content-types package. npm does not prune extraneous workspace entries on its own (npm/cli#5463), so these had to be removed by hand. Co-authored-by: manzoorwanijk <manzoorwanijk@git.wordpress.org> Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
What?
Part of: #77600
Merges
@wordpress/user-post-types+@wordpress/user-taxonomiesand their two admin pages into a single@wordpress/content-typespackage and a single?page=content-types-wp-adminpage with Post Types / Taxonomies tabs. Routes:/post-types,/post-types/$id,/taxonomies,/taxonomies/$id;/redirects to/post-types.Sharing between the two domains
Only the routing constants (
POST_TYPES_PATH,TAXONOMIES_PATH,POST_TYPE_ENTITY,TAXONOMY_ENTITY,NEW_ID) and the tabbedLayoutare shared for now. Rest reusable components, utils etc.. will be in follow ups.Edit/List components stay in the package, not the routes
This will be revisited when we share more utils/components etc.. Right now the previous two packages have too many naming conflicts and it's not worth it to add even more noise in this PR.
An alternative is to move the edit/list components in routes and rename each field prefixed with the entity.
Known issue (follow-up)
Saving a taxonomy with a changed
object_type(or a post type with a changedtaxonomiesfield) syncs the relationship server-side, but the client doesn't invalidategetEntityRecordsfor the other domain. Switching tabs after such a save can show stale rows. Pre-merge this was not an issue because each domain had its own admin page, so tab-equivalent navigation was a full page reload.Testing instructions
Content typesexperiment.Settings → Content Typesand play around with adding and editing post types and taxonomies.Use of AI Tools
Opus 4.7 with direction, changes and review