ComponentTreeItem specifies wrong main property

Created on 24 July 2025, 2 days ago

Overview

The default value for "mainPropertyName" of a field item is "value", but that's not existing for ComponentTreeItem.

I stumbled over a fatal error in custom elements module when auto-generating custom-elements based upon the typed data information. It tried to get the main-property "value", what is not existing.

I think in our case it's fair to say there is no "main property", thus NULL is the right return value.

Proposed resolution

Implement mainPropertyName().

πŸ› Bug report
Status

Active

Version

0.0

Component

Data model

Created by

πŸ‡¦πŸ‡ΉAustria fago Vienna

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @fago
  • Merge request !1355ComponentTreeItem specifies wrong main property β†’ (Open) created by fago
  • πŸ‡¦πŸ‡ΉAustria fago Vienna
  • πŸ‡¦πŸ‡ΉAustria fago Vienna
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    OMG LOL!

  • Pipeline finished with Success
    2 days ago
    Total: 2051s
    #555798
  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    It's not that we specified the wrong property, it's that the inherited \Drupal\Core\Field\FieldItemBase::mainPropertyName() does not make sense for XB's field type.

    (I bet there will be more such things β€” few field types in the Drupal ecosystem have as many field properties as XB's field type…)

    Thanks for the bug report!

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    WTAF happened to this MR? It's still @fago's commit from 10:43, so I don't think he pushed again? There was 1 commit, now there's 8?!

    I've been intermittently seeing this kind of problem on GitLab. Seems like it's having some integrity issues…

    Was going to merge, will now wait a bit for this to re-settle πŸ™ƒ

  • πŸ‡¦πŸ‡ΉAustria fago Vienna

    Thanks for the quick reviews!

    It's not that we specified the wrong property, it's that the inherited \Drupal\Core\Field\FieldItemBase::mainPropertyName() does not make sense for XB's field type.

    yep, exactly!

    >here was 1 commit, now there's 8?!

    They were there from the beginning.
    Maybe, there was some glitch between 0.x and 1.x when I created the PR, I was confused about the branches. But the diff is correct, so it should be fine to just squash-merge it.

  • πŸ‡§πŸ‡ͺBelgium wim leers Ghent πŸ‡§πŸ‡ͺπŸ‡ͺπŸ‡Ί

    AHHHHHHHHHH! So you developed on 0.x, the MR targeted 0.x and then you changed it to 1.x
    That explains everything.

    Except … HOW F'ING STUPID GitLab is being here, for not showing such a significant change (different target branch) in the "activity" entries:

    It lists zero-impact activity there, but this it does not.

    Made me lose 20 minutes of my day. 😬

    But the diff is correct, so it should be fine to just squash-merge it.

    Can't do that due to A) it not applying to 1.x, B) hence not running tests, C) the d.o-GitLab integration. Need to use the "merge" button on d.o, and then this won't work.

    Rebased to be able to land this πŸ‘

  • Pipeline finished with Success
    2 days ago
    Total: 3669s
    #555900
  • πŸ‡¦πŸ‡ΉAustria fago Vienna

    Oh I see, I'm sry to have caused this issue and it ate your time. The 1.x/0.x separation was new to me. :-/

Production build 0.71.5 2024