Skip to main content
Glama
URGENT-api-interception-visualization-fix.md•3.37 kB
# URGENT: API Interception Visualization Fix **Task ID**: URGENT-VIZ-FIX-001 **Status**: READY FOR EXECUTION **Priority**: CRITICAL **Owner**: Claude Code **Estimated Duration**: 2-3 hours **Dependencies**: Console log analysis complete --- ## šŸŽÆ Objective Fix composition visualization issue by implementing API interception in the browser automation workflow. ## šŸ” Problem Identified **Issue**: Compositions save successfully but don't render in browser after localStorage injection **Root Cause**: Composer uses hash-based routing + API calls, not localStorage reading **Solution**: Intercept API calls and return injected composition data ## šŸš€ Implementation ### **Target File** `/Users/ricardokawasaki/Desktop/euconquisto-composer-mcp-poc/dist/browser-automation-capture-v2.6.0.js` ### **Required Changes** **1. Add API Interception** (before Step 6 in executeWorkflow): ```javascript console.log('[v2.6.0] Step 6: Setup API Interception'); await page.evaluate((data) => { window._injectedComposition = data; const originalFetch = window.fetch; window.fetch = function(url, options) { if (url.includes('/storage/v1.0/content?uid=') && !url.includes('/versions/')) { console.log('šŸŽÆ INTERCEPTED: Returning injected composition'); return Promise.resolve(new Response(JSON.stringify({ status: 'success', data: window._injectedComposition }), { status: 200, headers: { 'Content-Type': 'application/json' } })); } return originalFetch.apply(this, arguments); }; }, compositionData); ``` **2. Add Navigation Trigger** (after save workflow): ```javascript // Get composition ID and trigger hash navigation const compositionId = await page.evaluate(() => { return window.location.hash.match(/composer\/([^?]+)/)?.[1] || 'test-composition'; }); // Navigate to trigger loading with interception const compositionUrl = `http://localhost:8080/composer#/embed/composer/${compositionId}`; await page.goto(compositionUrl); await page.waitForTimeout(3000); ``` **3. Keep Browser Open & Update Success Response**: ```javascript // DON'T close browser - keep it open for user interaction if (result.success) { return { content: [{ type: 'text', text: `āœ… COMPOSITION CREATED AND VISIBLE!\n\nšŸŽÆ Browser kept open for immediate use\nšŸ“± Interact with your composition now\nšŸ”— URL: ${page.url()}\nšŸ“Š Elements: ${compositionData.composition.elements.length}\n\nšŸ’” Leave browser open to view and test your educational content!` }] }; } else { // Only close browser on error await browser.close(); return errorResponse; } ``` ## āœ… Success Criteria - Compositions render visibly in browser after workflow - **Browser remains open** for immediate user interaction - All 6 current element types display correctly - Workflow time remains under 45 seconds - Users can immediately view and test educational content ## šŸ”§ Testing **Test with**: Simple photosynthesis composition (existing data structure) **Validate**: Browser shows rendered composition AND stays open for interaction **Verify**: All elements (header, text, image, video, flashcards, quiz) visible and interactive **Confirm**: Users can immediately explore the educational content --- **URGENT - Execute immediately to unblock roadmap implementation**

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rkm097git/euconquisto-composer-mcp-poc'

If you have feedback or need assistance with the MCP directory API, please join our Discord server