Skip to content

Troubleshooting

apps/docs/src/content/docs/drupal-integration/troubleshooting Click to copy
Copied! apps/docs/src/content/docs/drupal-integration/troubleshooting

Symptom: Raw HTML tags visible instead of styled components.

Causes:

  1. Library not loaded - Check browser console for 404 errors
  2. JavaScript module not supported - Ensure type="module" on script tag
  3. Cache issue - Clear Drupal cache: drush cr

Solution:

Terminal window
# Clear all caches
drush cr
# Verify library loads
# Check browser DevTools > Network > JS for the library file

Symptom: Content briefly appears unstyled before components render.

Solution: Add display: none until components are defined:

wc-card:not(:defined),
wc-button:not(:defined) {
display: none;
}

Symptom: Content doesn’t appear in the correct slot.

Cause: TWIG rendering adds wrapper elements that break slot targeting.

Solution: Use slot attribute on the immediate child:

{# Wrong - slot on wrapper div #}
<div slot="header">{{ content.field_title }}</div>
{# Right - slot on content element #}
<span slot="header">{{ content.field_title }}</span>

Symptom: Dynamically loaded content doesn’t initialize components.

Solution: Ensure Drupal Behaviors are properly configured:

Drupal.behaviors.wcInit = {
attach(context) {
// This runs on AJAX responses too
customElements.whenDefined('wc-card').then(() => {
// Components are ready
});
}
};

Symptom: Components blocked by Content Security Policy.

Solution: Add required CSP directives:

Content-Security-Policy: script-src 'self' https://cdn.jsdelivr.net;