⚡ Bolt: [성능 개선] i18n.js 초기화 시 불필요한 DOM 업데이트 방지#34
Conversation
- 현재 문서의 언어(`document.documentElement.lang`)를 `currentLang`의 초기값으로 사용하여 초기 로딩 시 기본 언어가 한국어일 때 발생하는 불필요한 DOM 업데이트를 방지합니다.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
💡 What:
i18n.js에서currentLang의 초기값을null대신document.documentElement.lang || "ko"로 설정했습니다.🎯 Why: 기존 코드는 초기 로딩 시
currentLang이null이어서, 이미 한국어로 렌더링된 페이지에 한국어를 다시 설정할 때 조기 종료(if (currentLang === lang) return;)가 작동하지 않고 모든[data-i18n]요소를 순회하며 업데이트 여부를 검사하는 불필요한 연산을 수행했습니다.📊 Impact: 초기 페이지 로딩 시 약 200개 이상의 다국어 요소에 대한 불필요한 DOM 탐색 및 비교 연산을 생략하여 메인 스레드 블로킹 시간을 줄입니다.
🔬 Measurement:
i18n.js로드 직후setLanguage함수 호출 시 DOM 트리를 순회하지 않고 바로 반환하는지 확인할 수 있습니다.PR created automatically by Jules for task 918277168306512882 started by @seonghobae