Skip to content

DataViews: remove kebabCase private import by inlining it - #81284

Merged
oandregal merged 1 commit into
trunkfrom
update/dataviews-inline-kebab-case
Aug 6, 2026
Merged

DataViews: remove kebabCase private import by inlining it#81284
oandregal merged 1 commit into
trunkfrom
update/dataviews-inline-kebab-case

Conversation

@oandregal

Copy link
Copy Markdown
Member

Part of #81230.

What?

Removes one of the @wordpress/components private API usages in @wordpress/dataviews: the kebabCase utility by making a local copy within the dataviews package.

Why?

See #81230.

How?

  • Adds packages/dataviews/src/utils/kebab-case.ts, a verbatim copy of the private kebabCase from packages/components/src/utils/strings.ts. Same implementation. Because the copy is identical, the generated action modal overlay class names will remain unchanged for any input.
  • Copies the full kebabCase test suite from components, including all _wp_to_kebab_case() parity cases.

Alternatives considered:

  • Inlining was chosen over making kebabCase a public export of @wordpress/components, since the utility was made private deliberately to avoid committing to a public utils surface. If a shared home for it ever materializes (e.g. a small dedicated package, which would also serve the other packages currently unlocking it from components), this local copy can be swapped out trivially.

Testing Instruction

  1. Run the unit tests: npm run test:unit packages/dataviews/src/utils/test/kebab-case.js.
  2. In the site editor, open Patterns, and choose "Duplicate" on a pattern's actions menu (a modal action).
  3. Inspect the modal overlay element and verify it still has the dataviews-action-modal dataviews-action-modal__duplicate-pattern classes and the modal is styled as before (no visual change).

Use of AI Tools

This PR was written with Claude Code (implementation, tests, and this description), under human direction and review.

Copilot AI balanced review requested due to automatic review settings August 6, 2026 12:53
@github-actions github-actions Bot added the [Package] DataViews /packages/dataviews label Aug 6, 2026
@oandregal oandregal self-assigned this Aug 6, 2026
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@oandregal oandregal added the [Type] Code Quality Issues or PRs that relate to code quality label Aug 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Ready to approve

The copied implementation and tests match the existing utility, and the dependency and call-site updates are complete.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

Removes DataViews’ private kebabCase dependency while preserving modal class-name behavior.

Changes:

  • Adds a local kebabCase implementation and parity tests.
  • Updates modal actions to use the local utility.
  • Declares change-case and documents the internal change.
File summaries
File Description
packages/dataviews/src/utils/kebab-case.ts Adds the local utility.
packages/dataviews/src/utils/test/kebab-case.js Adds parity coverage.
packages/dataviews/src/components/dataviews-item-actions/index.tsx Replaces the private import.
packages/dataviews/package.json Declares change-case.
packages/dataviews/CHANGELOG.md Records the internal change.
package-lock.json Updates workspace dependency metadata.
Review details
  • Files reviewed: 5/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Removes one of the @wordpress/components private API usages listed
in #81230. The utility is copied verbatim, including its change-case
dependency and the full test suite (Lodash and _wp_to_kebab_case
compatibility), so the generated action modal overlay class names
are byte-for-byte identical to before.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@oandregal
oandregal force-pushed the update/dataviews-inline-kebab-case branch from 0b21891 to 812e71c Compare August 6, 2026 12:55
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Size Change: +1.21 kB (+0.02%)

Total Size: 7.82 MB

📦 View Changed
Filename Size Change
build/modules/content-types/index.min.js 172 kB +527 B (+0.31%)
build/scripts/edit-site/index.min.js 311 kB +81 B (+0.03%)
build/scripts/editor/index.min.js 509 kB +138 B (+0.03%)
build/scripts/media-utils/index.min.js 128 kB +466 B (+0.37%)

compressed-size-action

@im3dabasia im3dabasia left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for working on this!

Looks like a straightforward merge! LGTM ✅

One CI test was failing, I have re-run it 🤞

@oandregal
oandregal merged commit 6348766 into trunk Aug 6, 2026
72 of 73 checks passed
@oandregal
oandregal deleted the update/dataviews-inline-kebab-case branch August 6, 2026 14:36
@github-actions github-actions Bot added this to the Gutenberg 23.8 milestone Aug 6, 2026
@oandregal

Copy link
Copy Markdown
Member Author

Potential, more ambitious, follow-up at #81294

talldan pushed a commit that referenced this pull request Aug 6, 2026
Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
oandregal added a commit that referenced this pull request Aug 7, 2026
Extracts the WP-parity kebabCase utility (backwards compatible with
Lodash's _.kebabCase() and Core's _wp_to_kebab_case()) into a new
dependency-only package (no wpScript), and migrates the two identical
copies:

- @wordpress/components: utils/strings.ts now re-exports kebabCase from
  the new package, so the existing private API surface and all unlock()
  consumers are unchanged. The kebabCase test suite moves to the new
  package.
- @wordpress/dataviews: removes the copy inlined in #81284 and imports
  the package directly.

Follow-up to #81284 and part of the direction discussed in #81230;
the utility originally became a components private API in #56758.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
oandregal added a commit that referenced this pull request Aug 7, 2026
Extracts the WP-parity kebabCase utility (backwards compatible with
Lodash's _.kebabCase() and Core's _wp_to_kebab_case()) into a new
dependency-only package (no wpScript), and migrates the two identical
copies:

- @wordpress/components: utils/strings.ts now re-exports kebabCase from
  the new package, so the existing private API surface and all unlock()
  consumers are unchanged. The kebabCase test suite moves to the new
  package.
- @wordpress/dataviews: removes the copy inlined in #81284 and imports
  the package directly.

Follow-up to #81284 and part of the direction discussed in #81230;
the utility originally became a components private API in #56758.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
oandregal added a commit that referenced this pull request Aug 7, 2026
Extracts the WP-parity kebabCase utility (backwards compatible with
Lodash's _.kebabCase() and Core's _wp_to_kebab_case()) into a new
dependency-only package (no wpScript), and migrates the two identical
copies:

- @wordpress/components: utils/strings.ts now re-exports kebabCase from
  the new package, so the existing private API surface and all unlock()
  consumers are unchanged. The kebabCase test suite moves to the new
  package.
- @wordpress/dataviews: removes the copy inlined in #81284 and imports
  the package directly.

Follow-up to #81284 and part of the direction discussed in #81230;
the utility originally became a components private API in #56758.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
amitraj2203 pushed a commit that referenced this pull request Aug 10, 2026
Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
shail-mehta pushed a commit that referenced this pull request Aug 12, 2026
Co-authored-by: oandregal <oandregal@git.wordpress.org>
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] DataViews /packages/dataviews [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants