fix(pop-card-list): 원본 컴포넌트 선택 안 되는 문제 수정

- CartListModeConfig에 sourceComponentId 추가
- cartType이 빈 문자열인 경우 componentId로 매칭
- Select value: sourceComponentId 기반 안정적 매칭
- 런타임: sourceComponentId > cartType > 첫 번째 순으로 폴백

원인: 4160 화면의 cartAction에 cartType 미설정 -> 빈 문자열 ->
Select 저장 시 undefined 순환 -> 선택 불가
This commit is contained in:
SeongHyun Kim 2026-02-27 15:16:37 +09:00
parent c1cf31f57b
commit 220e05d2ae
3 changed files with 22 additions and 11 deletions

View File

@ -515,7 +515,10 @@ export function PopCardListComponent({
const layoutJson = await screenApi.getLayoutPop(cartListMode.sourceScreenId);
const componentsMap = layoutJson?.components || {};
const componentList = Object.values(componentsMap) as any[];
const matched = cartListMode.cartType
// sourceComponentId > cartType > 첫 번째 pop-card-list 순으로 매칭
const matched = cartListMode.sourceComponentId
? componentList.find((c: any) => c.id === cartListMode.sourceComponentId)
: cartListMode.cartType
? componentList.find(
(c: any) =>
c.type === "pop-card-list" &&

View File

@ -933,15 +933,18 @@ function CartListModeSection({
const handleComponentSelect = (val: string) => {
if (val === "__none__") {
onUpdate({ ...mode, cartType: undefined });
onUpdate({ ...mode, cartType: undefined, sourceComponentId: undefined });
return;
}
// cartType 직접 매칭 또는 componentId 매칭 (__comp_ 접두사)
const found = val.startsWith("__comp_")
? sourceCardLists.find((c) => c.componentId === val.replace("__comp_", ""))
: sourceCardLists.find((c) => c.cartType === val);
if (found) {
onUpdate({ ...mode, cartType: found.cartType || undefined });
onUpdate({
...mode,
sourceComponentId: found.componentId,
cartType: found.cartType || undefined,
});
}
};
@ -997,7 +1000,11 @@ function CartListModeSection({
</div>
) : (
<Select
value={mode.cartType || "__none__"}
value={
mode.sourceComponentId
? (sourceCardLists.find(c => c.componentId === mode.sourceComponentId)?.cartType || `__comp_${mode.sourceComponentId}`)
: mode.cartType || "__none__"
}
onValueChange={handleComponentSelect}
>
<SelectTrigger className="mt-1 h-7 text-xs">

View File

@ -613,6 +613,7 @@ export interface CardResponsiveConfig {
export interface CartListModeConfig {
enabled: boolean;
sourceScreenId?: number;
sourceComponentId?: string;
cartType?: string;
statusFilter?: string;
}