1- // AnimationFactory.js - DV-Flow v1.3 완전 대응 (업데이트 )
1+ // AnimationFactory.js - DV-Flow v1.3 완전 대응 (key 수정 )
22import React from 'react' ;
33
44// 실제 애니메이션 컴포넌트들 import
@@ -21,7 +21,7 @@ export class AnimationFactory {
2121 'insertion-sort' : SortAnimation ,
2222 'merge-sort' : SortAnimation ,
2323 'quick-sort' : SortAnimation ,
24- 'sort' : SortAnimation , // 일반 정렬
24+ 'sort' : SortAnimation ,
2525
2626 // ✅ 트리 구조
2727 'binary-tree' : BinaryTreeAnimation ,
@@ -71,8 +71,9 @@ export class AnimationFactory {
7171 console . warn ( '⚠️ 구버전 JSON 구조 감지! events 필드가 없습니다.' ) ;
7272 }
7373
74+ // ⚡ CRITICAL: Date.now() 제거! 고정된 key 사용
7475 return React . createElement ( AnimationComponent , {
75- key : `animation-${ normalizedType } - ${ Date . now ( ) } ` ,
76+ key : `animation-${ normalizedType } ` , // 타입별 고정 key
7677 animationType : normalizedType ,
7778 ...props
7879 } ) ;
@@ -147,14 +148,13 @@ export class AnimationFactory {
147148 const hasCompare = events . some ( e => e . kind === 'compare' ) ;
148149 const hasSwap = events . some ( e => e . kind === 'swap' ) ;
149150 if ( hasCompare && hasSwap ) {
150- // 특정 정렬 알고리즘 감지 시도
151151 const hasPivot = events . some ( e => e . viz ?. pivot !== undefined ) ;
152152 if ( hasPivot ) return 'quick-sort' ;
153153
154154 const hasMerge = events . some ( e => e . kind === 'merge' ) ;
155155 if ( hasMerge ) return 'merge-sort' ;
156156
157- return 'bubble-sort' ; // 기본 정렬
157+ return 'bubble-sort' ;
158158 }
159159
160160 // 그래프 패턴
0 commit comments