Skip to content

Commit 0478b61

Browse files
authored
Merge pull request #4 from 0-ROK/fix-chain-builder-bugs
fix: 템플릿 선택 시 기본 매핑 설정을 추가하여, 첫 실행 시, 쿼리스트링이 반영되지 않는 문제
2 parents 09608a3 + 118c94a commit 0478b61

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/renderer/components/SortableStepItem.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,29 @@ export const SortableStepItem: React.FC<SortableStepItemProps> = ({
7878
const handleTemplateSelect = (templateId: string) => {
7979
const template = httpTemplates.find(t => t.id === templateId);
8080
if (template) {
81+
// Seed default mappings so execution can rely on explicit entries
82+
const pathParams = extractPathParams(template.pathTemplate);
83+
const queryParams = extractQueryParams(template.queryTemplate);
84+
85+
const defaultParamMappings = pathParams.reduce<Record<string, { type: 'auto' | 'fixed' | 'skip'; value?: string }>>((acc, param) => {
86+
acc[param] = step.params?.paramMappings?.[param] ?? { type: 'auto' };
87+
return acc;
88+
}, {});
89+
90+
const defaultQueryMappings = queryParams.reduce<Record<string, { type: 'auto' | 'fixed' | 'skip'; value?: string }>>((acc, param) => {
91+
acc[param] = step.params?.queryMappings?.[param] ?? { type: 'auto' };
92+
return acc;
93+
}, {});
94+
8195
onUpdateStep(step.id, {
8296
params: {
8397
...step.params,
8498
httpTemplateId: templateId,
8599
baseUrl: template.baseUrl,
86100
pathTemplate: template.pathTemplate,
87101
queryTemplate: template.queryTemplate,
102+
paramMappings: defaultParamMappings,
103+
queryMappings: defaultQueryMappings,
88104
// 출력 타입 초기화
89105
outputType: step.params?.outputType || 'full',
90106
}

0 commit comments

Comments
 (0)