fix(engine): 반복 렌더 경로의 리터럴 단일 바인딩 판정 누락 해소
판정 통일(engine-v1.55.0)에서 리터럴 해석을 BindingShape 한 곳으로 모았으나
renderItemChildren 만 `hasPipes → isComplexExpression → 경로 탐색` 3분기를 직접
갈라 리터럴을 몰랐다. 그 결과 같은 `{{true}}` 가 조건 자리에서는 true,
목록 셀·카드 등 반복 렌더 prop 자리에서는 undefined 로 갈렸다 —
통일이 없애려던 비대칭이 이 지점에만 남아 있었다.
형태 판정을 resolveSingleBindingValue 에 위임해 다른 경로와 같은 규칙을 쓴다.
같은 지점이 빈 바인딩(`{{}}`)도 몰라 경로 탐색으로 보내던 것을 함께 봉인했다.
브라우저 실측(배포 번들의 G7Core.renderItemChildren 직접 호출)으로 발견했고,
저장소 레이아웃의 리터럴 단일 바인딩 60건은 전부 if/condition 자리라
화면 표시에는 변화가 없다.
SEO 패리티: 봇 측 ExpressionEvaluator 는 이미 리터럴을 해석하고 있었으므로
이 수정은 React 경로를 봇 경로에 맞춘 것이다 (파일 헤더에 면제 사유 기재).
This commit is contained in:
1 parent
60cccbf62d
commit
65378fdeb6
6 files changed
+120
-41
No files matched your search
@@ -110,6 +110,39 @@ test.describe('렌더 경로 간 바인딩 해석 대칭', () => {
|
||||
expect(String(value)).not.toContain('{{');
|
||||
});
|
||||
|
||||
// @scenario binding_literal_symmetry
|
||||
// @effects same_expression_same_value_across_paths
|
||||
test('리터럴이 반복 렌더와 조건 판정에서 같은 값을 본다', async ({ page }) => {
|
||||
const result = await page.evaluate(() => {
|
||||
const g7 = (window as any).G7Core;
|
||||
const Span = function Span() { return null; };
|
||||
const context = { row: { id: 1 } };
|
||||
const viaRepeat = (expr: string) =>
|
||||
(g7.renderItemChildren(
|
||||
[{ type: 'basic', name: 'Span', props: { title: expr } }],
|
||||
context,
|
||||
{ Span },
|
||||
'e2e-literal',
|
||||
) as any[])[0]?.props?.title;
|
||||
|
||||
return {
|
||||
repeatTrue: viaRepeat('{{true}}'),
|
||||
repeatFalse: viaRepeat('{{false}}'),
|
||||
repeatNull: viaRepeat('{{null}}'),
|
||||
condTrue: g7.evaluateCondition('{{true}}', context),
|
||||
condFalse: g7.evaluateCondition('{{false}}', context),
|
||||
};
|
||||
});
|
||||
|
||||
// 수정 전: 반복 렌더 경로만 리터럴을 몰라 경로 탐색으로 새어 전부 undefined 였다.
|
||||
// 조건 경로는 리터럴을 알았으므로 같은 작성이 자리에 따라 갈렸다.
|
||||
expect(result.repeatTrue).toBe(true);
|
||||
expect(result.repeatFalse).toBe(false);
|
||||
expect(result.repeatNull).toBeNull();
|
||||
expect(result.repeatTrue).toBe(result.condTrue);
|
||||
expect(result.repeatFalse).toBe(result.condFalse);
|
||||
});
|
||||
|
||||
// @scenario binding_empty_expression
|
||||
// @effects same_expression_same_value_across_paths
|
||||
test('빈 바인딩이 컨텍스트 객체 전체를 노출하지 않는다', async ({ page }) => {
|
||||
|
||||
Reference in new issue
Block a user