Skip to content

fix: update default CMS type handling in Migration component to ensur…#963

Merged
umeshmore45 merged 1 commit intodevfrom
feature/wordpress
Feb 18, 2026
Merged

fix: update default CMS type handling in Migration component to ensur…#963
umeshmore45 merged 1 commit intodevfrom
feature/wordpress

Conversation

@AishDani
Copy link
Contributor

…e fallback to DEFAULT_CMS_TYPE

@AishDani AishDani requested a review from a team as a code owner February 18, 2026 07:38
@umeshmore45 umeshmore45 requested a review from Copilot February 18, 2026 11:10
@umeshmore45 umeshmore45 merged commit 78d3875 into dev Feb 18, 2026
11 checks passed
@umeshmore45 umeshmore45 deleted the feature/wordpress branch February 18, 2026 11:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates CMS type selection in the Migration page to ensure a default CMS type is used when stored/legacy CMS data can’t be resolved, aligning the migration flow with a consistent fallback behavior.

Changes:

  • Changes stored CMS lookup fallback from undefined to DEFAULT_CMS_TYPE.
  • Simplifies selectedCmsData selection to default to stored CMS (or the default).
Comments suppressed due to low confidence (1)

ui/src/pages/Migration/index.tsx:318

  • configCmsData (and its dependency configCmsType) is now computed but never used after simplifying selectedCmsData. This leaves dead code and will likely fail the @typescript-eslint/no-unused-vars rule; either remove these variables or reintroduce logic that uses them.
    // Look up CMS by config's cmsType (same parent-matching logic as LoadSelectCms.filterCMSData)
    const configCmsData: ICMSType | undefined = (configCmsType && validateArray(legacyCmsData?.all_cms))
      ? legacyCmsData?.all_cms?.find(
          (cms: ICMSType) => cms?.parent?.toLowerCase() === configCmsType
        )

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

(storedCmsData && storedCmsData?.parent?.toLowerCase() === configCmsType)
? storedCmsData
: (configCmsData ?? storedCmsData ?? DEFAULT_CMS_TYPE);
storedCmsData ?? DEFAULT_CMS_TYPE;
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The comment says config’s cmsType is the source of truth and that selection should prefer config when it differs, but selectedCmsData is now always storedCmsData (falling back to DEFAULT_CMS_TYPE). This appears to drop the config-vs-stored reconciliation behavior and can select the wrong CMS when config changes; either restore the previous parent-matching/precedence logic or update the comments and remove the config lookup entirely to match the intended behavior.

Suggested change
storedCmsData ?? DEFAULT_CMS_TYPE;
configCmsData && storedCmsData && storedCmsData.parent?.toLowerCase() === configCmsType
? storedCmsData
: (configCmsData ?? storedCmsData ?? DEFAULT_CMS_TYPE);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants