Skip to content

Fix: Update DataViews to fix settings page breakage in Gutenberg trunk - #984

Closed
aduth wants to merge 1 commit into
WordPress:developfrom
aduth:update/dataviews-private-apis
Closed

aduth wants to merge 1 commit into
WordPress:developfrom
aduth:update/dataviews-private-apis

Conversation

@aduth

@aduth aduth commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

What?

Updates @wordpress/dataviews and @wordpress/ui to their latest versions.

Why?

The AI settings page is currently broken on Gutenberg trunk, and will be broken in the next release of Gutenberg unless fixed.

The issue stems back to WordPress/gutenberg#81478 removing @wordpress/dataviews as an allowlisted package in @wordpress/private-apis, as the result of the work done in WordPress/gutenberg#81230 to remove private APIs usage in DataViews.

By removing DataViews from the allowlist, any consumer which bundles an older version of @wordpress/dataviews that still relies on those private APIs will fail. From the consumer point of view, the mitigation is to upgrade to the latest version.

How?

Upgrades DataViews to the latest version.

The package-lock.json diff is much larger than I'd anticipate or hope, but I'm not sure it's avoidable. This is what results from npm install after bumping the versions in package.json.

Use of AI Tools

AI assistance: Yes
Tool(s): Cursor IDE
Model(s): Auto (likely Composer)
Used for: Research of impact based on related pull request and equivalent fixes in other projects like Automattic/jetpack#51701, as well as actual bumping of versions. Changes were reviewed by myself.

Testing Instructions

Test with changes alongside Gutenberg either trunk or 23.9.0 RC1 prerelease.

To test locally, I created a .wp-env.override.json with the following contents to load from my sibling gutenberg code directory:

{
	"$schema": "https://schemas.wp.org/trunk/wp-env.json",
	"plugins": [
		".",
		"../gutenberg",
		"https://downloads.wordpress.org/plugin/ai-provider-for-google.zip",
		"https://downloads.wordpress.org/plugin/ai-provider-for-openai.zip"
	]
}

Then run npm run build && npm run wp-env start.

Go to http://localhost:8888/wp-admin/options-general.php?page=ai-wp-admin

Confirm page loads as expected.

Before After
image image

Changelog Entry

See include CHANGELOG.md edit.

Open WordPress Playground Preview

@aduth
aduth requested a review from a team August 28, 2026 19:58
@github-actions

github-actions Bot commented Aug 28, 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: aduth <aduth@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>

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

@youknowriad

Copy link
Copy Markdown
Contributor

Why are the imports here not using the "/wp" bundle. Without this, there are other potential issues as WP gets updated.

@aduth
aduth force-pushed the update/dataviews-private-apis branch from e2611e0 to 1acd99b Compare August 31, 2026 13:23
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.57%. Comparing base (0833eec) to head (1acd99b).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #984   +/-   ##
==========================================
  Coverage      74.57%   74.57%           
  Complexity      3132     3132           
==========================================
  Files            132      132           
  Lines          12213    12213           
==========================================
  Hits            9108     9108           
  Misses          3105     3105           
Flag Coverage Δ
unit 74.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aduth

aduth commented Aug 31, 2026 •

Copy link
Copy Markdown
Member Author

Why are the imports here not using the "/wp" bundle. Without this, there are other potential issues as WP gets updated.

It probably should, per the documented note. My initial instinct is that might be a bigger lift, but given the lockfile turmoil I'm facing here and potential risk of updates from a newer version of DataViews & UI packages, that might be a good alternative. Assuming it's mostly a matter of updating the imports, I'll push an alternative pull request for that.

@aduth

aduth commented Aug 31, 2026 •

Copy link
Copy Markdown
Member Author

Aside: The /wp note being buried in the DataView's documentation might contribute to it being missed. Since it mentions @wordpress/scripts, it's also not clear if it applies to projects using @wordpress/build.

@aduth

aduth commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

Alternative updating to use /wp entrypoint: #989

@dkotter

dkotter commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@aduth With #989 now merged, can this one be closed?

@aduth

aduth commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

@dkotter I'll go ahead and close, though I imagine "keeping dependencies up to date" is still valid independent of #989. But since #989 addresses the immediate concern of crashing, that can happen on a more relaxed timeline.

@aduth aduth closed this Aug 31, 2026
@dkotter

dkotter commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@dkotter I'll go ahead and close, though I imagine "keeping dependencies up to date" is still valid independent of #989. But since #989 addresses the immediate concern of crashing, that can happen on a more relaxed timeline.

Worth noting we are purposely not updating most of these dependencies as we want to ensure we're using the same versions that are in our lowest supported WordPress version (7.0). See #831 and #832 for more on that

@aduth

aduth commented Aug 31, 2026

Copy link
Copy Markdown
Member Author

Worth noting we are purposely not updating most of these dependencies as we want to ensure we're using the same versions that are in our lowest supported WordPress version (7.0). See #831 and #832 for more on that

Interesting, and good to know! I don't think it's a great situation if plugins are intentionally not using the latest versions of packages, and one of the intended benefits of these "bundled" packages like @wordpress/dataviews, @wordpress/ui, and @wordpress/admin-ui is that they're more self-contained. In fact, that's what the changes in #989 are all about, since it flips DataViews to bundle everything it relies on into the AI plugin rather than relying on window.wp globals which may or may not be present depending on the version of WordPress being run (to your point of a 7.0 floor). But this isn't universal, and a package like @wordpress/ui is "bundled" but doesn't have a /wp entrypoint, and so some of its internal dependencies do end up relying on window.wp globals if it's built using @wordpress/scripts or @wordpress/build. This is probably something to be solved / standardized in Gutenberg so that consumer projects like this can rely on using the latest versions.

@dkotter

dkotter commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Probably worth noting that @wordpress/ui and @wordpress/admin-ui are the two packages right now that we don't follow this approach with and instead keep those more or less up-to-date (via Dependabot bumps). So maybe @wordpress/dataviews should also follow that approach? Probably worth a discussion on #832 for those types of things though

@simison

simison commented Sep 1, 2026

Copy link
Copy Markdown
Member

Since DataViews gets bundled, doing updates now lets you absorb breaking changes incrementally, in smaller batches, rather than facing them all at once during a larger future version jump. That should end up being less (or at least easier) work in total.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants