Plugin Directory

Changeset 3446753


Ignore:
Timestamp:
01/25/2026 11:39:59 PM (2 months ago)
Author:
fahdi
Message:

HOTFIX Release CardCrafter v1.14.1 - Resolve Critical JavaScript Error

EMERGENCY FIX: Resolves widespread user-reported card loading failures

CRITICAL ISSUE RESOLVED:

  • Fixed "Unexpected token '<'" JavaScript error preventing card loading
  • Users were receiving HTML error pages instead of JSON data
  • JavaScript fetch was failing to parse server responses

FIXES IMPLEMENTED:
✅ Enhanced fetch error handling with content-type validation
✅ Better error messages to diagnose WordPress vs JSON issues
✅ Onboarding modal safety checks for missing DOM elements
✅ Fixed admin interface element access in onboarding
✅ Improved error diagnostics with response preview

TECHNICAL IMPROVEMENTS:

  • cardcrafter.js: Added content-type header validation before JSON parsing
  • cardcrafter.js: Enhanced error messages with specific guidance
  • cardcrafter.php: DOM element safety checks in onboarding JavaScript
  • cardcrafter.php: Improved scrolling behavior for dynamic content

ERROR HANDLING NOW INCLUDES:

  • "Received HTML page instead of JSON" for WordPress errors
  • "WordPress returned '0'" for unregistered AJAX actions
  • Truncated response preview for debugging invalid responses

This hotfix resolves the primary barrier preventing users from successfully
loading card grids and provides clear diagnostic information for troubleshooting.

PRIORITY: HIGH - Users unable to use plugin functionality without this fix

Location:
cardcrafter-data-grids
Files:
4 added
4 edited
8 copied

Legend:

Unmodified
Added
Removed
  • cardcrafter-data-grids/tags/1.14.1/assets/js/cardcrafter.js

    r3445263 r3446753  
    120120                    throw new Error('Network response was not ok: ' + response.status);
    121121                }
     122               
     123                // Check if response is actually JSON by looking at content-type
     124                var contentType = response.headers.get('content-type');
     125                if (!contentType || !contentType.includes('application/json')) {
     126                    // If not JSON, get text to see what we actually received
     127                    return response.text().then(function(text) {
     128                        if (text.trim().startsWith('<!DOCTYPE') || text.trim().startsWith('<html')) {
     129                            throw new Error('Received HTML page instead of JSON data. This usually indicates a WordPress error. Check WordPress error logs.');
     130                        } else if (text.trim().startsWith('0')) {
     131                            throw new Error('WordPress returned "0" - check if AJAX action is registered properly.');
     132                        } else {
     133                            throw new Error('Invalid JSON response. Received: ' + text.substring(0, 100) + '...');
     134                        }
     135                    });
     136                }
     137               
    122138                return response.json();
    123139            })
  • cardcrafter-data-grids/tags/1.14.1/cardcrafter.php

    r3446752 r3446753  
    44 * Plugin URI: https://github.com/TableCrafter/cardcrafter-data-grids
    55 * Description: Transform JSON data and WordPress posts into beautiful card grids. Perfect for teams, products, portfolios, and blogs.
    6  * Version: 1.14.0
     6 * Version: 1.14.1
    77 * Author: fahdi
    88 * Author URI: https://github.com/TableCrafter
     
    2121*/
    2222
    23 define('CARDCRAFTER_VERSION', '1.14.0');
     23define('CARDCRAFTER_VERSION', '1.14.1');
    2424define('CARDCRAFTER_URL', plugin_dir_url(__FILE__));
    2525define('CARDCRAFTER_PATH', plugin_dir_path(__FILE__));
     
    565565           
    566566            // Show onboarding modal immediately for new users
    567             if (currentStep === 0) {
     567            if (currentStep === 0 && $('.cc-onboarding-overlay').length) {
    568568                $('#cc-onboarding-overlay').show();
    569569                showStep(1);
     
    608608                // Update the demo URL in the admin interface
    609609                var demoUrl = '<?php echo CARDCRAFTER_URL; ?>demo-data/' + selectedDemo + '.json';
    610                 $('#cc-source-url').val(demoUrl);
    611                
    612                 // Trigger preview to generate cards
    613                 $('#cc-preview-btn').click();
     610                var urlInput = $('#cc-preview-url');
     611                if (urlInput.length) {
     612                    urlInput.val(demoUrl);
     613                   
     614                    // Trigger preview to generate cards
     615                    var previewBtn = $('#cc-preview-btn');
     616                    if (previewBtn.length) {
     617                        previewBtn.click();
     618                    }
     619                }
    614620               
    615621                // Save demo preference
     
    705711               
    706712                // Scroll to generated cards if they exist
    707                 if ($('.cardcrafter-container').length) {
    708                     $('html, body').animate({
    709                         scrollTop: $('.cardcrafter-container').offset().top - 100
    710                     }, 500);
    711                 }
     713                setTimeout(function() {
     714                    if ($('.cardcrafter-container').length) {
     715                        $('html, body').animate({
     716                            scrollTop: $('.cardcrafter-container').offset().top - 100
     717                        }, 500);
     718                    }
     719                }, 500);
    712720            }
    713721        });
  • cardcrafter-data-grids/tags/1.14.1/readme.txt

    r3446752 r3446753  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.14.0
     7Stable tag: 1.14.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    199199
    200200== Changelog ==
     201
     202= 1.14.1 =
     203* HOTFIX: Resolved critical JavaScript error "Unexpected token '<'" preventing card loading
     204* IMPROVED: Enhanced fetch error handling with content-type validation before JSON parsing
     205* IMPROVED: Better error messages to diagnose WordPress errors vs JSON parsing issues
     206* FIXED: Onboarding modal safety checks for DOM elements that may not exist yet
     207* FIXED: Admin interface element access in onboarding system
     208* TECHNICAL: Added specific error handling for HTML responses, WordPress '0' returns, and invalid JSON
    201209
    202210= 1.14.0 =
  • cardcrafter-data-grids/trunk/assets/js/cardcrafter.js

    r3445263 r3446753  
    120120                    throw new Error('Network response was not ok: ' + response.status);
    121121                }
     122               
     123                // Check if response is actually JSON by looking at content-type
     124                var contentType = response.headers.get('content-type');
     125                if (!contentType || !contentType.includes('application/json')) {
     126                    // If not JSON, get text to see what we actually received
     127                    return response.text().then(function(text) {
     128                        if (text.trim().startsWith('<!DOCTYPE') || text.trim().startsWith('<html')) {
     129                            throw new Error('Received HTML page instead of JSON data. This usually indicates a WordPress error. Check WordPress error logs.');
     130                        } else if (text.trim().startsWith('0')) {
     131                            throw new Error('WordPress returned "0" - check if AJAX action is registered properly.');
     132                        } else {
     133                            throw new Error('Invalid JSON response. Received: ' + text.substring(0, 100) + '...');
     134                        }
     135                    });
     136                }
     137               
    122138                return response.json();
    123139            })
  • cardcrafter-data-grids/trunk/cardcrafter.php

    r3446752 r3446753  
    44 * Plugin URI: https://github.com/TableCrafter/cardcrafter-data-grids
    55 * Description: Transform JSON data and WordPress posts into beautiful card grids. Perfect for teams, products, portfolios, and blogs.
    6  * Version: 1.14.0
     6 * Version: 1.14.1
    77 * Author: fahdi
    88 * Author URI: https://github.com/TableCrafter
     
    2121*/
    2222
    23 define('CARDCRAFTER_VERSION', '1.14.0');
     23define('CARDCRAFTER_VERSION', '1.14.1');
    2424define('CARDCRAFTER_URL', plugin_dir_url(__FILE__));
    2525define('CARDCRAFTER_PATH', plugin_dir_path(__FILE__));
     
    565565           
    566566            // Show onboarding modal immediately for new users
    567             if (currentStep === 0) {
     567            if (currentStep === 0 && $('.cc-onboarding-overlay').length) {
    568568                $('#cc-onboarding-overlay').show();
    569569                showStep(1);
     
    608608                // Update the demo URL in the admin interface
    609609                var demoUrl = '<?php echo CARDCRAFTER_URL; ?>demo-data/' + selectedDemo + '.json';
    610                 $('#cc-source-url').val(demoUrl);
    611                
    612                 // Trigger preview to generate cards
    613                 $('#cc-preview-btn').click();
     610                var urlInput = $('#cc-preview-url');
     611                if (urlInput.length) {
     612                    urlInput.val(demoUrl);
     613                   
     614                    // Trigger preview to generate cards
     615                    var previewBtn = $('#cc-preview-btn');
     616                    if (previewBtn.length) {
     617                        previewBtn.click();
     618                    }
     619                }
    614620               
    615621                // Save demo preference
     
    705711               
    706712                // Scroll to generated cards if they exist
    707                 if ($('.cardcrafter-container').length) {
    708                     $('html, body').animate({
    709                         scrollTop: $('.cardcrafter-container').offset().top - 100
    710                     }, 500);
    711                 }
     713                setTimeout(function() {
     714                    if ($('.cardcrafter-container').length) {
     715                        $('html, body').animate({
     716                            scrollTop: $('.cardcrafter-container').offset().top - 100
     717                        }, 500);
     718                    }
     719                }, 500);
    712720            }
    713721        });
  • cardcrafter-data-grids/trunk/readme.txt

    r3446752 r3446753  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.14.0
     7Stable tag: 1.14.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    199199
    200200== Changelog ==
     201
     202= 1.14.1 =
     203* HOTFIX: Resolved critical JavaScript error "Unexpected token '<'" preventing card loading
     204* IMPROVED: Enhanced fetch error handling with content-type validation before JSON parsing
     205* IMPROVED: Better error messages to diagnose WordPress errors vs JSON parsing issues
     206* FIXED: Onboarding modal safety checks for DOM elements that may not exist yet
     207* FIXED: Admin interface element access in onboarding system
     208* TECHNICAL: Added specific error handling for HTML responses, WordPress '0' returns, and invalid JSON
    201209
    202210= 1.14.0 =
Note: See TracChangeset for help on using the changeset viewer.