()
| 1533 | if (state.chatMessages?.length) renderChatMessages(state.chatMessages); |
| 1534 | else if (state.currentView === "chat") resetChatThread(); |
| 1535 | } |
| 1536 | |
| 1537 | function setLocale(locale) { |
| 1538 | if (!supportedLocales.has(locale) || state.locale === locale) return; |
| 1539 | const profileDraft = captureProfileDraft(); |
| 1540 | state.locale = locale; |
| 1541 | window.localStorage.setItem(LOCALE_KEY, state.locale); |
| 1542 | applyLocale(); |
| 1543 | if (state.currentProfile) { |
| 1544 | renderProfileForm(state.currentProfile); |
| 1545 | restoreProfileDraft(profileDraft); |
| 1546 | } |
| 1547 | } |
| 1548 | |
| 1549 | function captureProfileDraft() { |
| 1550 | const ids = [ |
| 1551 | "profileUserId", |
| 1552 | "scholarUrl", |
| 1553 | "homepageUrl", |
| 1554 | "pdfPaths", |
no test coverage detected