Skip to content

Commit 95af9a0

Browse files
authored
fix(UVE): copy content modal error (#34474)
This PR fixes: #34300 ### Video https://github.com/user-attachments/assets/46f95aa6-c3b4-4a77-9b92-84692421ebc7
1 parent 3e9629d commit 95af9a0

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

core-web/libs/dotcms-models/src/lib/dot-tree-node.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ export interface DotTreeNode {
44
pageId: string;
55
relationType: string;
66
treeOrder: string;
7-
variantId: string;
7+
variantId?: string;
88
personalization?: string;
99
}

core-web/libs/portlets/edit-ema/portlet/src/lib/store/features/editor/withEditor.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { computed, signal } from '@angular/core';
77
import { ActivatedRoute, Router } from '@angular/router';
88

99
import { DotPropertiesService } from '@dotcms/data-access';
10-
import { DotDeviceListItem } from '@dotcms/dotcms-models';
10+
import { DEFAULT_VARIANT_ID, DotDeviceListItem } from '@dotcms/dotcms-models';
1111
import { UVE_MODE } from '@dotcms/types';
1212
import { WINDOW } from '@dotcms/utils';
1313
import { mockDotDevices, seoOGTagsMock } from '@dotcms/utils-testing';
@@ -930,15 +930,15 @@ describe('withEditor', () => {
930930
it('should return the current TreeNode with variantId from store.$variantId()', () => {
931931
const { container, contentlet } = ACTION_PAYLOAD_MOCK;
932932

933-
// When variantId is not set in pageParams, $variantId() returns empty string
933+
// When variantId is not set in pageParams, $variantId() returns DEFAULT_VARIANT_ID
934934
expect(store.getCurrentTreeNode(container, contentlet)).toEqual({
935935
containerId: 'container-identifier-123',
936936
contentId: 'contentlet-identifier-123',
937937
pageId: '123',
938938
personalization: 'dot:persona:dot:persona',
939939
relationType: 'uuid-123',
940940
treeOrder: '-1',
941-
variantId: '' // Uses store.$variantId() which comes from pageParams()?.variantId ?? ''
941+
variantId: DEFAULT_VARIANT_ID
942942
});
943943
});
944944

core-web/libs/portlets/edit-ema/portlet/src/lib/store/features/withPageContext.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { signalStoreFeature, type, withComputed } from '@ngrx/signals';
22

33
import { computed, Signal } from '@angular/core';
44

5-
import { DotExperimentStatus } from '@dotcms/dotcms-models';
5+
import { DEFAULT_VARIANT_ID, DotExperimentStatus } from '@dotcms/dotcms-models';
66
import { UVE_MODE } from '@dotcms/types';
77

88
import { withFlags } from './flags/withFlags';
@@ -79,7 +79,7 @@ export function withPageContext() {
7979
$hasAccessToEditMode,
8080
$languageId: computed(() => viewAs()?.language?.id || 1),
8181
$pageURI: computed(() => page()?.pageURI ?? ''),
82-
$variantId: computed(() => pageParams()?.variantId ?? ''),
82+
$variantId: computed(() => pageParams()?.variantId ?? DEFAULT_VARIANT_ID),
8383
$canEditPage: computed(() => $hasAccessToEditMode() && $isEditMode())
8484
} satisfies PageContextComputed;
8585
}

0 commit comments

Comments
 (0)