MDC Troubleshooting Guide

Common issues and solutions for MDC component rendering and functionality

🔧 MDC Troubleshooting Guide

This guide helps you diagnose and fix common issues with MDC components not rendering properly.

🚨 Common Issues

Issue 1: Components Show as Empty Dark Blocks

Symptoms:

Root Causes:

  1. Component Not Registered: The MDC component is not properly registered in the component registry
  2. Parser Issues: The MDC parser is not correctly parsing the component syntax
  3. Renderer Problems: The MDC renderer is not properly rendering the components
  4. Mock Components: The system is using mock components instead of real implementations

Solutions:

Check Component Registration

<mdc:code-block language="typescript"> // Verify component is registered in MDCRendererService private initializeComponentRegistry(): void { this.registerComponent('mdc-code-block', CodeBlockComponent); this.registerComponent('mdc-interactive-demo', InteractiveDemoComponent); this.registerComponent('mdc-diagram', DiagramComponent); // ... other components }

Verify Component Syntax

<mdc:code-block language="markdown">

<mdc:code-block language="typescript"> export class ExampleComponent { @Input() title = 'Hello World'; }

<mdc:code-block language="typescript">
export class ExampleComponent {
  @Input() title = 'Hello World';
}
</mdc:code-block>

Enable Debug Mode

<mdc:code-block language="yaml">

In frontmatter

ui: showDebugInfo: true showComponentInfo: true

Issue 2: Components Not Parsed Correctly

Symptoms:

Solutions:

Check Frontmatter Syntax

<mdc:code-block language="yaml">


title: "Document Title" type: mdc interactive: true status: published

Component definitions

components:

UI configuration

ui: showMetadata: true enableInteraction: true

Verify Component Properties

<mdc:code-block language="markdown">

<mdc:code-block language="typescript" interactive="true" theme="vs-dark">

// Code content

<mdc:code-block language=typescript interactive=true theme=vs-dark>

// Code content

Issue 3: Performance Issues

Symptoms:

Solutions:

Enable Lazy Loading

<mdc:code-block language="yaml">

In frontmatter

performance: lazyLoad: true preload: false cacheStrategy: normal maxRenderTime: 10000 componentTimeout: 5000

Optimize Component Usage

<mdc:code-block language="markdown">

<mdc:interactive-demo component="HeavyComponent" lazy="true" placeholder="Loading component...">

Issue 4: Styling and Theme Problems

Symptoms:

Solutions:

Check Theme Integration

<mdc:code-block language="scss"> // Ensure components inherit theme variables .mdc-component { background: var(--ux-surface); color: var(--ux-on-surface); border: 1px solid var(--ux-outline); border-radius: var(--ux-border-radius); }

Verify CSS Classes

<mdc:code-block language="html">

🔍 Debugging Steps

Step 1: Enable Debug Information

<mdc:code-block language="yaml">

In frontmatter

ui: showDebugInfo: true showComponentInfo: true showMetadata: true

Step 2: Check Browser Console

<mdc:code-block language="javascript"> // Look for these error messages in console: // - "Component not found: mdc-code-block" // - "Failed to parse MDC component" // - "Rendering timeout exceeded" // - "Invalid component properties"

Step 3: Verify Component Registration

<mdc:code-block language="typescript"> // Check if components are registered console.log('Registered components:', this.componentRegistry.keys());

// Verify component exists const component = this.componentRegistry.get('mdc-code-block'); if (!component) { console.error('Component mdc-code-block not registered'); }

Step 4: Test Component Parsing

<mdc:code-block language="typescript"> // Test MDC parsing const testContent = <mdc:code-block language="typescript"> export class TestComponent {} </mdc:code-block>;

const result = await this.parserService.parseMDCContent(testContent); console.log('Parsed components:', result.components);

🛠️ Quick Fixes

Fix 1: Convert Markdown Code Blocks to MDC Components

Problem: Components wrapped in markdown code blocks Solution: Remove the markdown wrapper

<mdc:code-block language="markdown">

<mdc:code-block language="typescript">
export class ExampleComponent {}
</mdc:code-block>

<mdc:code-block language="typescript"> export class ExampleComponent {}

Fix 2: Correct Property Syntax

Problem: Missing quotes around property values Solution: Add proper quotes

<mdc:code-block language="markdown">

<mdc:code-block language=typescript interactive=true>

<mdc:code-block language="typescript" interactive="true">

Fix 3: Fix JSON Properties

Problem: Invalid JSON in component properties Solution: Validate JSON syntax

<mdc:code-block language="markdown">

<mdc:interactive-demo :props='{"variant": "primary", "size": "large"}'>

<mdc:interactive-demo :props='{"variant": "primary", "size": "large"}'>

📊 Diagnostic Tools

Component Status Checker

<mdc:interactive-demo component="ComponentStatusChecker" :props='{"showAllComponents": true}'>

This tool checks the status of all MDC components.

Performance Monitor

<mdc:live-data source="/api/mdc/performance" refresh="5s" template="performance-monitor" fallback="Loading performance data...">

Error Reporter

<mdc:conditional condition="user.role === 'developer'" fallback="Developer access required for error reporting">

<mdc:interactive-demo component="ErrorReporter" :props='{"autoReport": true}'>

🎯 Prevention Tips

1. Use Proper Syntax

2. Test Components

3. Monitor Performance

4. Keep Components Updated

🔗 Additional Resources

📞 Getting Help

If you're still experiencing issues:

  1. Check the Console: Look for error messages in browser console
  2. Enable Debug Mode: Set showDebugInfo: true in frontmatter
  3. Test Minimal Example: Create a simple MDC file with one component
  4. Contact Support: Reach out to the development team with specific error messages

This troubleshooting guide is maintained by the GoGrab Development Team and is updated regularly based on common issues and solutions.