Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

### Fixed

- Settings page no longer crashes to a blank screen when `window.classifAISettings` is undefined (for example when a caching or optimization plugin changes script order); the settings data is now read defensively (props [@thisismyurl](https://github.com/thisismyurl) via [#1135](https://github.com/10up/classifai/pull/1135)).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note we generally don't include changelog entries in each PR as those are manually pulled at release time


## [3.8.0] - 2026-03-20

### Added
Expand Down
9 changes: 8 additions & 1 deletion src/js/settings/components/classifai-settings/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ClassifAIRegistration } from '../classifai-registration';
import { ClassifAIWelcomeGuide } from './welcome-guide';
import { Notices } from '../feature-settings/notices';

const { services, features } = window.classifAISettings;
const { services = {}, features = {} } = window.classifAISettings || {};
Comment thread
dkotter marked this conversation as resolved.

/**
* FeatureSettingsWrapper component to render the feature settings.
Expand All @@ -43,6 +43,13 @@ const FeatureSettingsWrapper = () => {
const { service, feature } = useParams();
const serviceFeatures = Object.keys( features[ service ] || {} );

// When the settings data is unavailable (for example the global was
// missing) there is no feature to route to, so render nothing rather than
// navigating to an undefined path.
if ( ! serviceFeatures.length ) {
return null;
}

if ( ! serviceFeatures.includes( feature ) ) {
return <Navigate to={ serviceFeatures[ 0 ] } replace />;
}
Expand Down
Loading