Skip to content

DataFormPostSummary: fix different useSelect returned values #79478

Merged
ntsekouras merged 3 commits into
trunkfrom
df-summary-fix-use-select-unstable-refs
Jun 24, 2026
Merged

DataFormPostSummary: fix different useSelect returned values #79478
ntsekouras merged 3 commits into
trunkfrom
df-summary-fix-use-select-unstable-refs

Conversation

@ntsekouras

Copy link
Copy Markdown
Contributor

What?

Follow up of: #76934

The linked PR introduced a warning for returning different values in useSelect: Non-equal value keys: entityData, entityIds. This PR solves that.

Testing instructions

  1. Enable the Editor Inspector: Use DataForm experiment.
  2. Edit a post and open the summary panel and the dev tools
  3. no useSelect warning should be shown and editing should work exactly as before

Use of AI Tools

Opus 4.8 with direction, changes and review

@ntsekouras ntsekouras requested a review from Mamaduka June 24, 2026 08:57
@ntsekouras ntsekouras self-assigned this Jun 24, 2026
@ntsekouras ntsekouras added [Type] Bug An existing feature does not function as intended [Type] Experimental Experimental feature or API. labels Jun 24, 2026
@github-actions github-actions Bot added the [Package] Editor /packages/editor label Jun 24, 2026
@ntsekouras ntsekouras removed the [Type] Experimental Experimental feature or API. label Jun 24, 2026
@github-actions

github-actions Bot commented Jun 24, 2026

Copy link
Copy Markdown

Size Change: -37 B (0%)

Total Size: 7.51 MB

📦 View Changed
Filename Size Change
build/scripts/editor/index.min.js 475 kB -37 B (-0.01%)

compressed-size-action

@Mamaduka

Copy link
Copy Markdown
Member

@ntsekouras, can you share a bit more detail on why we need to "complex" data fetching here?

@github-actions

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: ntsekouras <[email protected]>
Co-authored-by: Mamaduka <[email protected]>

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

@ntsekouras

Copy link
Copy Markdown
Contributor Author

@ntsekouras, can you share a bit more detail on why we need to "complex" data fetching here?

What do you mean? Does it look more complex now?

By making the returned extra entities in a flat object we gain the shallowEqual checks for useSelect. availableTemplates are also used by the fields so I think it's fine to get separately.

With your comment though I noticed that availableTemplates can be fetched in the first useSelect and I updated that.

@ntsekouras ntsekouras force-pushed the df-summary-fix-use-select-unstable-refs branch from 97e0ad9 to 1088cf7 Compare June 24, 2026 10:34
@ntsekouras ntsekouras force-pushed the df-summary-fix-use-select-unstable-refs branch from 1088cf7 to efa9803 Compare June 24, 2026 10:40
@Mamaduka

Copy link
Copy Markdown
Member

After the split, useSelect logic is easier to follow, but there's still overall complexity in how everything is handled in this file. What's the main reason for handling ENTITIES logic this way?

I know this is a more complex implementation of the DataForm component, but how can we make it easier to work with?

Apologies for rambling; these thoughts are somewhat related. It's not a blocker, but it's worth considering.

P.S. Going to test this in a few and approve for merging properly.

@ntsekouras

ntsekouras commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

but there's still overall complexity in how everything is handled in this file. What's the main reason for handling ENTITIES logic this way?

Yeah, I definitely agree here! In the future we need to figure out a good API to properly support multi-entity forms and consumers shouldn't have to do anything like this. This exists right now only because of the lack of API, and the thing we gain is that the form for templates can omit these fields (if someone uses the filter for the view config).

@Mamaduka Mamaduka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can confirm that warnings are no longer triggered.

In the future we need to figure out a good API to properly support multi-entity forms and consumers shouldn't have to do anything like this.

Do we have a tracking issue for similar enhancements?

@ntsekouras ntsekouras merged commit 472b417 into trunk Jun 24, 2026
42 checks passed
@ntsekouras ntsekouras deleted the df-summary-fix-use-select-unstable-refs branch June 24, 2026 11:28
@github-actions github-actions Bot added this to the Gutenberg 23.5 milestone Jun 24, 2026
@ntsekouras

Copy link
Copy Markdown
Contributor Author

Do we have a tracking issue for similar enhancements?

We have various issues for such enhancements, although I don't think we have a specific issue for this yet. The reason I'm not yet creating one is because the focus is elsewhere right now (extensibility) and I want to properly investigate what to suggest in that issue. It's probably something we need in core, but I need to explore other use cases for example to see what makes more sense to suggest. In core right now this is the only case we have (home/index template).

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

Labels

[Package] Editor /packages/editor [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants