Problem/Motivation

If you have paragraphs that are no longer being referenced by the default revision of their parent, then nothing is shown at all.

This is extremely confusing because in extreme cases, it is possible that you see usages on the overview, but then the detail page shows nothing.

The problem is that getParentEntity() returns the default revision, and that might no longer use the paragraph. But it still makes sense to show it.

The only case when it should be shown as an actual orphan is when the parent entity no longer exists.

Proposed resolution

Remove the field values check.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

Berdir created an issue. See original summary.

berdir’s picture

Status: Active » Needs review
StatusFileSize
new2.43 KB

So this basically removes a lot of code and it also ensures that it always shows the label of the initial paragraph (e.g if you have a paragraph container and that container is no longer referenced).

I think the current behavior is worse than showing paragraph orphans that might not be shown anymore, it will at least show a "(previous revision)" suffix.

And instead of the referenced issue to improve handling *if* there are orphans, we are working on the ability to clean up & delete orphans, which will not just solve the problem on the list page but also the total count. Just like my proposal for #3002332: Track composite (e.g. paragraph) entities directly and only as their host would, but that's another one of those things that I don't know if/when I'll find time for it.

berdir’s picture

As an alternative, it would be possible to build a query that covers all revisions to make sure that there is still at least one revision of the parent using that paragraph. But again, IMHO we need to solve this by getting rid of orphans and not handling them better.

Status: Needs review » Needs work

The last submitted patch, 2: entity-usage-3056026-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

berdir’s picture

Ok, I do remember a bit more now. These workarounds exist because the current labels of paragraphs are indeed *really* bad.

I updated #2954039: Fix ::label() logic and add a ParagraphInterface::getOrphanStatus() helper and I improved the labels a lot, so we should postpone this on that I guess.

marcoscano’s picture

For visibility, we might end up marking this as won't-fix in the 2.x branch, since in a theoretical 3.x branch being cooked in #3060802: Refactor module architecture in a simpler, opinionated and more performant approach this wouldn't be an issue anymore.

berdir’s picture

Status: Needs work » Needs review
StatusFileSize
new2.64 KB

Reroll for latest beta. While there's still plenty of room for improvements, this is IMHO a considerable improvement and the referenced paragraphs issue has been committed and released a while ago.

berdir’s picture

Updated the test assertion with what is now shown, which I think shows nicely how this is better instead of just ignoring this as the usage *is* still recorded and counted, which is very confusing to users.

  • marcoscano committed aeb58d9 on 8.x-2.x authored by Berdir
    Issue #3056026 by Berdir: Remove orphan handling of paragraphs when...
marcoscano’s picture

Status: Needs review » Fixed

I agree that the workaround is no longer needed. Thanks for working on this!
Committed to dev.

Status: Fixed » Closed (fixed)

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