mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-12-01 01:44:11 +03:00
The `i18n.changeLanguage` IPC handler returned the result of i18next's `changeLanguage`, which is a translation function. A function cannot be structured-cloned, so every call from the renderer rejected with `DataCloneError` even though the language had changed in the main process. The handler now awaits the change and returns nothing. A unit test calls the handler and checks the language changed and the result can be cloned; on canary it fails with `DataCloneError: (...args) => this.t(...args) could not be cloned.` Found by @keepClamDown in #15616. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Language changes continue to apply as requested, while the request no longer returns an internal result. * **Tests** * Added coverage for changing the application language and restoring the default language after testing. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: DarkSky <darksky2048@gmail.com>