- Issue created by @luke.leber
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
๐ง Fixed the title! ๐
default: false default_value: false examples: [false]
XB uses the first example value as the default. You should be able to see this at
/admin/config/development/configuration/single/export
: export theComponent
config entity for this SDC and you'll explicitly see thedefault_value
in there.Relevant docs: https://git.drupalcode.org/project/experience_builder/-/blob/0.x/docs/co... โ but that does NOT state that that is used as the default value. A slight tweak to that simple bullet would go a long way I think :)
This means the test coverage in
ui/tests/e2e/prop-types.cy.js
is incomplete:it('Boolean', () => { cy.waitForElementContentInIframe('#test-bool code', 'true'); cy.waitForElementContentNotInIframe('#test-bool code', 'false'); cy.findByLabelText('Bool') .assertToggleState(true) .toggleToggle() .assertToggleState(false); cy.waitForElementContentInIframe('#test-bool code', 'false'); cy.waitForElementContentNotInIframe('#test-bool code', 'true'); });
โ Any chance you could add the missing test coverage? ๐
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Actually, I think this is clearer still.
- Merge request !454Allow default value of false to be set for boolean props โ (Open) created by luke.leber
- ๐บ๐ธUnited States luke.leber Pennsylvania
โ Any chance you could add the missing test coverage? ๐
All signs point to probably not ๐ญ. NW and slowly backs away.
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Also, SDC allows
default: โฆ
because it's part of JSON Schema itself, but the SDC subsystem doesn't actually use/support it. I observed this 4 months ago at #3462705-19: [META] Missing features in SDC needed for XB โ .IOW: you're running into one of many SDC bugs/oversights we've spotted while working on XB, see ๐ [SPIKE] Comprehensive plan for integrating with SDC Active for the overview :)
- Status changed to Needs work
2 months ago 1:35pm 19 March 2025 - ๐บ๐ธUnited States Kristen Pol Santa Cruz, CA, USA
I thought I already reported this a long time agoโฆ hmmโฆ maybe it was closed
- ๐บ๐ธUnited States Kristen Pol Santa Cruz, CA, USA
๐ [PP-1] Can't toggle boolean prop back to true after changing to false Postponed was marked as duplicate but never got fixed it seems
- ๐บ๐ธUnited States Kristen Pol Santa Cruz, CA, USA
Thanks for bumping priority :) I find that Iโll set to false and the component behavior seems fine but the UI later shows it as true even though the component still seems to behave as itโs false โฆ maybe thatโs whatโs explained but Iโm on my phone on my flight to Atlanta so hard to read well :D
I am able to reproduce the reported bug by following the steps mentioned.
Steps to Reproduce:
- Add a new code component.
- Add a prop with the following details:
- Name: Expand by default
- Type: Boolean
- Required: False
- Example value: False
- Click on "Add to component".
{ "errors": [ { "detail": "Prop \"expandByDefault\" has invalid example value: [] String value found, but a boolean or an object is required", "source": { "pointer": "" } }, { "detail": "This value should be of the correct primitive type.", "source": { "pointer": "props.expandByDefault.examples.0" } } ] }
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Thanks, that definitely seems like a blocker for ๐ฑ Milestone 1.0.0-beta1: Start creating non-throwaway sites Active then!
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
Crediting @mayur-sose for confirming this is still relevant ๐ ๐
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
This is showing a server-side validation error, meaning the client is sending the string
"false"
instead of the booleanfalse
. Seems like a pretty simple bug to fix on the client :) - ๐ฎ๐ณIndia Akhil Babu Chengannur
akhil babu โ made their first commit to this issueโs fork.
This issue has been fixed with : #3520706 ๐ Can't add in-browser code component with checkbox prop to the library Active .
@wim-leers we can close this ticket.- ๐ฎ๐ฑIsrael heyyo Jerusalem
I was happy to read that the boolean SDC issue has been fixed, but it looks like it didn't.
I suppose it was marked as duplicate by mistake, thinking the issue was for code components but it is for SDC components. - ๐ซ๐ฎFinland lauriii Finland
Sorry about that. I think I got confused because it looks like #12 ๐ Setting default values does work for boolean props Active was tested with code components but the original issue was for SDC ๐
- ๐ฎ๐ฑIsrael heyyo Jerusalem
I want this closed as you do, don't worry ๐
- ๐ง๐ชBelgium wim leers Ghent ๐ง๐ช๐ช๐บ
@mayur-sose: Why did you link to ๐ Can't add in-browser code component with checkbox prop to the library Active ? That's completely unrelated to the bug reported here ๐ That was about creating a
(JavaScript)Component
config entity, this is about using an SDC that is available as a component in XB, and then trying to use the widget in the component instance form on the right to populate that prop.Can you please test again with an SDC as described in the issue summary? ๐ Thanks!