Skip to content
Merged
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { UmbContentDetailModel, UmbElementValueModel } from '../types.js';

Check warning on line 1 in src/Umbraco.Web.UI.Client/src/packages/content/content/workspace/content-detail-workspace-base.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ New issue: Overall Code Complexity

This module has a mean cyclomatic complexity of 4.02 across 41 functions. The mean complexity threshold is 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
import { UmbContentCollectionManager } from '../collection/index.js';
import { UmbContentWorkspaceDataManager } from '../manager/index.js';
import { UmbMergeContentVariantDataController } from '../controller/merge-content-variant-data.controller.js';
Expand Down Expand Up @@ -500,7 +500,23 @@
data.values = dataValues;
*/

return { ...data, values: processedValues };
// Merge: start with processed values, then add any original server values
Comment thread
nielslyngsoe marked this conversation as resolved.
Outdated
// that weren't covered by the preset builder's variant options.
// This prevents segment-specific values from being silently dropped
// when variant options don't cover all culture+segment combinations.
const mergedValues = [...processedValues];
const variantKey = (v: { alias: string; culture: string | null; segment: string | null }) =>
`${v.alias}|${UmbVariantId.Create(v).toString()}`;
const coveredKeys = new Set(processedValues.map(variantKey));
for (const serverValue of data.values) {
const key = variantKey(serverValue);
if (!coveredKeys.has(key)) {
coveredKeys.add(key);
mergedValues.push(serverValue);
}
}

return { ...data, values: mergedValues };

Check warning on line 519 in src/Umbraco.Web.UI.Client/src/packages/content/content/workspace/content-detail-workspace-base.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ Getting worse: Complex Method

_processIncomingData increases in cyclomatic complexity from 9 to 11, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
}

/**
Expand Down
Loading