What's happening and why:
Three compounding causes, all confirmed from source code:
1. Module-level crash (critical). src/js/settings/components/classifai-settings/index.js line 34:
const { services, features } = window.classifAISettings;
This runs at module scope, before any React component. If window.classifAISettings is undefined for any reason, it throws a TypeError immediately — the React app never mounts, no error boundary catches it, blank page.
2. NitroPack breaks the injection order. ClassifAI injects the data via wp_add_inline_script(..., 'before'). NitroPack (active on the site) defers or reorders scripts, so settings.js can execute before the inline data block — triggering #1.
3. get_asset_info() silently returns null if dist/settings.asset.php doesn't exist, causing the script to be enqueued with no dependencies — @wordpress/data etc. may not be loaded when the module runs.
Proposed fixes:
- Guard the destructure:
const { services = {}, features = {} } = window.classifAISettings || {};
- Wrap the app in a React error boundary
- Exclude
classifai-settings from NitroPack deferral (or drop the global entirely in favour of the REST fetch already in place)
Env: ClassifAI 3.8.0, WP 6.9.4, PHP 8.4.20, WP Engine, NitroPack 1.19.3
What's happening and why:
Three compounding causes, all confirmed from source code:
1. Module-level crash (critical).
src/js/settings/components/classifai-settings/index.jsline 34:This runs at module scope, before any React component. If
window.classifAISettingsis undefined for any reason, it throws aTypeErrorimmediately — the React app never mounts, no error boundary catches it, blank page.2. NitroPack breaks the injection order. ClassifAI injects the data via
wp_add_inline_script(..., 'before'). NitroPack (active on the site) defers or reorders scripts, sosettings.jscan execute before the inline data block — triggering #1.3.
get_asset_info()silently returnsnullifdist/settings.asset.phpdoesn't exist, causing the script to be enqueued with no dependencies —@wordpress/dataetc. may not be loaded when the module runs.Proposed fixes:
const { services = {}, features = {} } = window.classifAISettings || {};classifai-settingsfrom NitroPack deferral (or drop the global entirely in favour of the REST fetch already in place)Env: ClassifAI 3.8.0, WP 6.9.4, PHP 8.4.20, WP Engine, NitroPack 1.19.3