Problem/Motivation

The Layout Builder usage plugin uses the \Drupal\entity_usage\EntityUsageTrackBase::checkAndPrepareEntityIds utility with revision IDs but non default revisions can erroneously get left out because the query is not including all revisions.

Steps to reproduce

Use patch from #3181406: Wrong text when entity is layout builder revision (new work soon) or one of the related closed issues. Add usage and remove from the non default revision. Notice that the usage is missing, as in count($ids parameter) !== count(returned $ids).

Proposed resolution

Quick fix.

Remaining tasks

Review/merge.

User interface changes

API changes

None

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dpi created an issue. See original summary.

dpi’s picture

Assigned: dpi » Unassigned
Status: Active » Needs review
dpi’s picture

Theres some minor static analysis improvements to make phpstan, but especially downstream users using this API with PHPStan, happier.

marcoscano’s picture

I agree with the changes from the MR, but it would be nice to expand the test coverage to catch this bug as well.
Also, linking #3547273: Deleting paragraphs causes the entity usage tab to display confusing information to raise visibility on that refactor.
Thanks!

alexpott made their first commit to this issue’s fork.

alexpott’s picture

Status: Needs review » Reviewed & tested by the community

I've added test coverage which was missing so we're good to go here. Thanks @dpi for filing the issue and making the fix.

  • alexpott committed 7e375b88 on 5.x
    fix: #3576178 Layout builder usage can be broken+missing when usage is...

  • alexpott committed 5fbd6267 on 8.x-2.x
    fix: #3576178 Layout builder usage can be broken+missing when usage is...
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.