Component preview not loading for JS components

Created on 25 February 2025, about 1 month ago

Overview

The component preview that generates a preview in real time for components when they are hovered isn't working for JS components.

Steps to reproduce:

  1. Create a JS component
  2. Go back to editing a page
  3. Hover over the component
  4. Confirm that there's no component preview visible on hover

Proposed resolution

User interface changes

๐Ÿ› Bug report
Status

Active

Version

0.0

Component

Page builder

Created by

๐Ÿ‡ซ๐Ÿ‡ฎFinland lauriii Finland

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

Merge Requests

Comments & Activities

  • Issue created by @lauriii
  • First commit to issue fork.
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar-pd

    The component preview is now loading, but it appears empty. Debugging the issue.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 995s
    #435582
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar-pd

    I think the work on default_markup for code components is still pending.

    default_markup: "@todo Make something ๐Ÿ†’ in https://www.drupal.org/project/experience_builder/issues/3498889" - Which appears to be fixed issue.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Updating title for consistent terminology.

    Tagging per https://www.drupal.org/project/experience_builder/issues/3455753#release... ๐ŸŒฑ Milestone 0.2.0: Experience Builder-rendered nodes Active .

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    #6: Good observation, but that's not responsible for the preview ๐Ÿ˜…

    /xb/api/config/component does render preview markup for code components:

      "js.optional": {
        "source": "Code component",
        "metadata": {
          "slots": [
            
          ]
        },
        "field_data": {
          "maybe": {
            "required": false,
            "jsonSchema": {
              "type": "string"
            },
            "sourceType": "static:field_item:string",
            "value": null,
            "expression": "โ„น๏ธŽstringโŸvalue"
          }
        },
        "dynamic_prop_source_candidates": [
          
        ],
        "transforms": {
          "maybe": {
            "mainProperty": [
              
            ]
          }
        },
        "id": "js.optional",
        "name": "optional",
        "library": "primary_components",
        "category": "@todo",
        "default_markup": "<!-- xb-start-5b3715c6-9e10-4fa9-9692-732bfe366912 --><astro-island uid=\"5b3715c6-9e10-4fa9-9692-732bfe366912\"\n        component-url=\"/sites/default/files/astro-island/pKL_OwLDMlNxnBnBYIsn9BSu349KEpkBmq26qw_z8EQ.js\"\n        component-export=\"default\"\n        renderer-url=\"/modules/contrib/experience_builder/ui/lib/astro-hydration/dist/client.js\"\n        props=\"{}\"\n        ssr=\"\" client=\"only\"\n        opts=\"{&quot;name&quot;:&quot;optional&quot;,&quot;value&quot;:&quot;preact&quot;}\"><script type=\"module\" src=\"/modules/contrib/experience_builder/ui/lib/astro-hydration/dist/client.js\" blocking=\"render\"></script><script type=\"module\" src=\"/sites/default/files/astro-island/pKL_OwLDMlNxnBnBYIsn9BSu349KEpkBmq26qw_z8EQ.js\" blocking=\"render\"></script></astro-island><!-- xb-end-5b3715c6-9e10-4fa9-9692-732bfe366912 -->",
        "css": "<link rel=\"stylesheet\" media=\"all\" href=\"/sites/default/files/css/css_2L-jRULv7_xXe52gIO_bjqU3o7kiFhu1A3RE26luuI8.css?delta=0&amp;language=en&amp;theme=olivero&amp;include=eJxLrShILcpMzUtOjU8qzcxJSS3STywuKcqPzyzOScxL0csvKMnMz0vMAQBNxxA1\" />\n",
        "js_header": "",
        "js_footer": "<script src=\"/sites/default/files/js/js_62jyEDukuEKD8nfERQhtlwDsBadoEVzY0V2toERniis.js?scope=footer&amp;delta=0&amp;language=en&amp;theme=olivero&amp;include=eJxLrShILcpMzUtOjU8qzcxJSS3STywuKcrXy6hMKUosyczPAwDxxA3H\"></script>\n"
      },
    

    Investigatingโ€ฆ

  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands balintbrews Amsterdam, NL
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Paired with @balintbrews โ€” he gave me a hunch!

    Note how the example in #10 does not include the import maps!

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Bingo:

    What was needed, is making #attached[import_maps] be respected not just when rendering a full HTML response, but also when rendering each individual component preview.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Per @hooroomoo's review โ€” they manually tested it; it didnโ€™t interfere with any click events for opening the menus which was their concern ๐Ÿฅณ

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia omkar-pd

    ๐Ÿ™Œ๐Ÿ™Œ๐Ÿ‘๐Ÿ‘

  • Pipeline finished with Skipped
    about 1 month ago
    #435951
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024