Files
AFFiNE/packages
CommaBotandDarkSky bd338f8698 fix(electron): do not return the translation function over IPC (#15901)
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>
2026-11-23 22:54:13 +08:00
..
2026-11-23 17:19:29 +08:00