Closed (duplicate)
Project:
Experience Builder
Component:
Page builder
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Sep 2024 at 20:01 UTC
Updated:
13 Sep 2024 at 12:06 UTC
Jump to comment: Most recent
This is a minor thing and not a blocker as it can be worked around.
If you have a prop like:
level:
type: string
title: Level
description: 'Semantic level: 1, 2, 3, 4, 5, 6.'
default: '2'
enum:
- '1'
- '2'
- '3'
- '4'
- '5'
- '6'
examples:
- '2'
then you get this error when trying to change the prop in the sidebar prop form:
Drupal\Core\Render\Component\Exception\InvalidComponentException: [level] Integer value found, but a string or an object is required/n[level] Does not have a value in the enumeration ["1","2","3","4","5","6"] in Drupal\Core\Theme\Component\ComponentValidator->validateProps() (line 203 of /var/www/html/web/core/lib/Drupal/Core/Theme/Component/ComponentValidator.php).
Decide if we should allow integers masquerading as strings. If so, handle accordingly.
Sidebar form will let you change the prop value.
Comments
Comment #2
kristen polI'm an idiot. Just use an integer type. I'm so tired :/
Comment #3
lauriiiThank you @kristen pol for updating this! I'm keeping this as a minor bug report as it impacts DX. This may be still desired because of that.
Comment #4
shyam_bhattWe can add the prop with type integer as per the below code. It will generate a new filter level with no error.
Comment #5
kristen polSee comment #2 above
Comment #6
shyam_bhattyes, Kristen pol. Thanks for the comment. I added the code for better visibility.
Comment #7
kristen polMoving back to active .
Comment #8
kristen polRunning into this for the "data card" because you can have "+100" or "50" or similar. If it's a string, then the "50" won't work, but if it's an integer than "+100" won't work. Moving to normal.
Comment #9
wim leersAFAICT this is once again a duplicate of #3463842: [META] Redux sync on ALL prop types, not just ones with a single [value] property, because the
options_selectfield widget for thelist_integerfield type generates something likeattribute for each
<option>, the client-side must know when to map those to integers.Comment #10
kristen polI assume this is related:
#3473702: Numeric field input crashes contextual settings panel
Comment #11
bnjmnmDuplicate of #3473702: Numeric field input crashes contextual settings panel