🇦🇺🏝.au GMT+10
Account created on 21 November 2008, over 16 years ago
#

Merge Requests

More

Recent comments

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Rough plan to address #24

* Emit an event from auto save manager
* Subscribe to event in \Drupal\experience_builder\EventSubscriber\AssetGenerator
* Either new method in \Drupal\experience_builder\AssetManager for autosave _ OR _ have the component return a different asset path if in preview in \Drupal\experience_builder\Entity\XbAssetInterface::getCssPath and \Drupal\experience_builder\Entity\XbAssetInterface::getJsPath

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Committed to 11.x - thanks
Discussed backport with @catch and decided not needed because this isn't a stable blocker

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Good point. Experience builder is only using it in an IFrame so sidesteps that issue

@effulgentsia pointed out that support for multiple importmao scripts is coming to browsers which would also help, but that's a way off yet

So probably worth ignoring the XB approach for now

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Ignore the default value in the component above {name} = 'Steve' if I fix that to {name = 'Steve' } I get a name to show, but it's always Steve, i.e. the props still don't get passed in.

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

In my local testing this is allowing hydration although props aren't being passed through properly.
Ran out of time to work out what is wrong with props:

Here's my component

uuid: 221b3268-089f-48dd-ad84-52a9d9dd868c
langcode: en
status: true
dependencies:
  config:
    - experience_builder.js_component.chips
label: Chips
id: js.chips
source: js
category: '@todo'
settings:
  plugin_id: chips
  prop_field_definitions:
    name:
      field_type: string
      field_storage_settings: {  }
      field_instance_settings: {  }
      field_widget: string_textfield
      default_value:
        value: steve
      expression: ℹ︎string␟value

And my Javascript component:

uuid: 690ce531-b957-42f2-925d-cac7bd042cf0
langcode: en
status: true
dependencies: {  }
machineName: chips
name: Chips
required: {  }
props:
  name:
    title: Name
    type: string
    examples:
      - steve
slots: {  }
js:
  original: "const Title = ({name} = 'Steve') => {\n  return <h1 className=\"biggin\">Heya {name}</h1>\n}\nexport default Title;"
  compiled: "import { jsxs as _jsxs } from \"react/jsx-runtime\";\nconst Title = ({ name } = 'Steve')=>{\n    return /*#__PURE__*/ _jsxs(\"h1\", {\n        className: \"biggin\",\n        children: [\n            \"Heya \",\n            name\n        ]\n    });\n};\nexport default Title;\n"
css:
  original: '.biggin { font-size: 5rem;}'
  compiled: "/*removed a load of tailwind stuff here that I didn't add*/.biggin{font-size:5rem}"

Here's how it is rendered in the island

<astro-island uid="14806625-5dd9-4035-9da4-93cccf9859a8" component-url="/sites/default/files/astro-island/i1mwDMruPt1dJK1tlNyp7MGMN38P9JKooOtZVqAxnQc.js" component-export="default" renderer-url="/modules/experience_builder/ui/lib/astro-hydration/dist/client.js" props="{&quot;name&quot;:&quot;bobby&quot;}" client="only" opts="{&quot;name&quot;:&quot;Chips&quot;,&quot;value&quot;:&quot;preact&quot;}" data-xb-uuid="14806625-5dd9-4035-9da4-93cccf9859a8"><h1 class="biggin">Heya </h1></astro-island>

You can see the name prop is being set. but not being rendered properly

Screenshot showing 3 placed instances

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

With experience builder I went with a much simpler approach which is to support #attached of type 'import_maps' and then have an attachments processor that consolidated all them and made a single <script type="importmap">

Might be worth considering here too

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

larowlan created an issue.

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Made sure we have enable/disable without the status key _and_ removed the delete operation
Added tests for both

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Got a fix up for this

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Either way we need a custom list builder to support disabling via the UI but preventing from showing up in the UI

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

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

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

This was introduced by https://git.drupalcode.org/project/experience_builder/-/commit/8c961df3c...

Which added support for the listing showing disabled config entities - needed for code components.

The status entity key has been in components since https://git.drupalcode.org/project/experience_builder/-/commit/5c1c06641...

We had coverage for JS, but not for the converse on components and patterns, so I've added that.

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

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

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

I cannot reproduce this either

I think my 'fresh install' included enabling navigation, layout builder and layout discovery but then uninstalling them.

But skipping that step, can't reproduce.

Putting this down to being under the weather.

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Thought about this some more and we also need a way to have the Astro island load the draft JS and CSS

NW for that

Thanks for all the work overnight

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

My page is also mangled (although that could be an 11.x issue)

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Tests are passing now

I added a test to address @tedbow's comment - but it appears it hasn't gone far enough

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

I think #20 is ok, somewhere I saw @lauriii say having it consistent means we can record generic training videos, so that makes sense.

I think the original goal was to allow modules to have a say in all of this. But I think so long as they can put things in the extensions drawer, that need is met.

So plus one for moving ahead with #20/ #21

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Cutting a new tag, thanks for taking this on

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Sounds like option 2 is the preferred approach, I'll start on that

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

This looks good to me, I manually tested it and confirmed it is working as expected.
I also tried to remove ::findTargetForProps and confirmed we cannot do that without 📌 Split model values into resolved and raw Active

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Some phpunit fails, looks like I can reasonably cherry-pick the fix from 3.x, giving that a crack

Not worried about phpcs etc

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Thanks mate, copied in the gitlab ci file from 3.x, let's see how that goes

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

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

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Looks good to me, nice cleanup

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

@akhil babu is correct, it is wrong in the config entity

drush cget experience_builder.component.block.views_block.who_s_online-who_s_online_block
uuid: 57867d30-4a30-4b86-af25-12cb6fa03497
langcode: en
status: true
dependencies: {  }
label: 'Who&#039;s online block' 👈️👈️👈️
id: block.views_block.who_s_online-who_s_online_block
source: block
category: 'Lists (Views)'
settings:
  plugin_id: 'views_block:who_s_online-who_s_online_block'
  default_settings:
    id: 'views_block:who_s_online-who_s_online_block'
    label: "Who's online"
    label_display: ''
    provider: views
    views_label: ''
    items_per_page: none


🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

larowlan created an issue.

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Rebased, should be good to go again if green

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

This was good to merge a week back, +1 if it still applies

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

At present the permission is 'access content'
You would need to implement a route subscriber and alter the route to use a different permission

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Generally I would encourage that to be handled in the theme via preprocess_breadcrumb

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Thanks, the fix should be as simple as adding #tree => TRUE on your element, but I would also accept an MR to make that the default

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

There is a core idea that has some overlap here 📌 Make Drupal core multi-frontend Active
I think we can close this but revive it in core by adding support for splitting the renderer up so that HTML is just one serialization format we can generate from render arrays.

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Now that 📌 Move clientside assumptions about prop form data shape into a series of prop specific transforms Active is in I think we should explore using these for entity form fields as well.

I could also see a world where we had server-side transforms (these would be callbacks) so that we could sidestep issues like \Drupal\Core\Entity\Element\EntityAutocomplete::validateEntityAutocomplete and the like - this would hopefully mean we could decouple from the form system and not need to build and submit a form anymore.

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

I confirmed #34 solved the issue so I reverted f3fd9d2f

#34 changed the behaviour in HEAD - previously if you sent a field you didn't have access it would generate an error.

Now the field is ignored.

I updated the test to reflect this and it now passes - that is 9592dd2a

Would be good to get a +1 from Ted/Wim/Lauri/Alex on the new behaviour

This should be green again and the 2 bugs are now fixed.

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

This doesn't happen in head because we don't use the converter service, we use a custom convert method in preview controller

I vote we revert back to that and sort it separately

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

That's the style tag added in DummyPropsEditForm, it can go, it was something I tried to get the test passing

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

My gut feel is although it would be more elegant, it would be tight coupling.

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

larowlan created an issue.

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

There were 2 methods in ApiLayoutController that had '@todo make this a trait' pointing here.
I ended up making them a trait to share with ApiPreviewController, but I like your proposal on the issue to make it one controller.

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Can I suggest something other than propSources - we'll likely want to ship jsonSchema for block components - and currently this sits under field_data.

Or if we rename it to propSources, can we move the schema elsewhere?

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Also blocked on 📌 OpenAPI spec insufficiently precise for `LayoutComponent` Active which will make the diff here smaller

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Addressed #18 - it is much simpler than that now that 📌 Maintain a per-component set of prop expressions/sources Active is in, we just send the model. That's it. Rebased, then squashed to do that and then removed 📌 Include the preview HTML in the layout controller payload Active

Will start on the review feedback and the remaining tasks (including fixing tests).

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Commit ace768f6 has the work here on top of 📌 Support server side massage and validation of component prop form values Active

When that is in, we can rebase --onto origin/0.x and drop d78ade44

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Opened the source code of @swc/wasm-web and it has this

async function __wbg_init(module_or_path) {
    if (wasm !== undefined) return wasm;


    if (typeof module_or_path !== 'undefined') {
        if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
            ({module_or_path} = module_or_path)
        } else {
            console.warn('using deprecated parameters for the initialization function; pass a single object instead')
        }
    }

    if (typeof module_or_path === 'undefined') {
        module_or_path = new URL('wasm_bg.wasm', import.meta.url);
    }
    const imports = __wbg_get_imports();

    if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
        module_or_path = fetch(module_or_path);
    }

    __wbg_init_memory(imports);

    const { instance, module } = await __wbg_load(await module_or_path, imports);

    return __wbg_finalize_init(instance, module);
}

export { initSync };
export default __wbg_init;

so the default export takes a module_or_path

We're calling it with no arguments

But we should be able to pass in the path there and it will end up with

module_or_path = fetch(module_or_path);
🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

I think we can use Rollup's replace plugin here (unless I don't understand the problem).

We can use __DRUPAL_XB_BASE_PATH__ in all of our code and in our viteconfig we can pass config to rollup plugin replace to replace that with a reference to a global, e.g. drupalSettings.xbBasePath that we ensure is always available on the page via #attached

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Yes I think this can land and I think some of the changes in 📌 Will passing the model props for a component via GET parameters hit limitations due to URL length Active highlight that we need to make sure the #parents are consistent - in fact they should be applied in the ComponenteInputForm rather than in each source plugin. That will move this closer I think - will try to take a stab at this before the end of the week

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

This is for when we fetch the component inputs form

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Ok, added a hidden field with those values to ensure it works with AJAX.

Yes these can be tampered, but so could the URL so 🤷

Maybe we need an anti-tamper hash?

🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

Yep, doesn't work with AJAX forms because the form needs to be rebuilt and that requires the params - and they are no longer in the body of the request because now we're POSTing the Drupal form

That was far too easy

Production build 0.71.5 2024