Multiple alias crashed the electron client

Description

Hello. It seems that the electron client is crashing after adding an email alias on a custom IMAP account

To Reproduce…

Steps to reproduce the behavior:

  1. Add custom IMAP account (e.g: toto@customdn.com)
  2. Wait for sync to complete
  3. go in account settings and add an alias (e.g: toto2@customdn.com)
  4. Electron client is displaying an error message

Expected Behavior

Not crashing/no error :slight_smile:

Screenshots

Setup

  • OS and Version: Fedora 40
    • Installation Method: snap
  • Mailspring Version: 1.14.0-07c62cca

Additional Context

This bugs exists for at least 3 years.

Error: Error while calling Contact.fromString: string contains more than one email
    at Function.fromString (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/flux/models/contact.ts:412:13)
    at Account.meUsingAlias (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/flux/models/account.ts:166:20)
    at file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/flux/stores/account-store.ts:328:36
    at _AccountStore._cachedGetter (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/flux/stores/account-store.ts:263:46)
    at _AccountStore.aliases (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/flux/stores/account-store.ts:323:17)
    at _AccountStore.accountForEmail (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/flux/stores/account-store.ts:303:30)
    at Contact.isMe (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/flux/models/contact.ts:484:27)
    at Message.isFromMe (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/flux/models/message.ts:353:40)
    at file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/internal_packages/thread-list/lib/thread-list-participants.tsx:99:43
    at Array.every (<anonymous>)
    at ThreadListParticipants.getTokensFromMessages (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/internal_packages/thread-list/lib/thread-list-participants.tsx:99:18)
    at ThreadListParticipants.getTokens (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/internal_packages/thread-list/lib/thread-list-participants.tsx:141:19)
    at ThreadListParticipants.render (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/internal_packages/thread-list/lib/thread-list-participants.tsx:19:24)
    at ah (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/react-dom/cjs/react-dom.production.min.js:163:192)
    at $g (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/react-dom/cjs/react-dom.production.min.js:162:264)
    at eh (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/react-dom/cjs/react-dom.production.min.js:171:13)
    at ai (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/react-dom/cjs/react-dom.production.min.js:202:255)
    at bi (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/react-dom/cjs/react-dom.production.min.js:203:271)
    at Fi (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/react-dom/cjs/react-dom.production.min.js:218:174)
    at Gi (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/react-dom/cjs/react-dom.production.min.js:217:174)
    at ii (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/react-dom/cjs/react-dom.production.min.js:214:252)
    at xg (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/react-dom/cjs/react-dom.production.min.js:212:94)
    at Object.enqueueSetState (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/react-dom/cjs/react-dom.production.min.js:133:223)
    at ListTabular.Component.setState (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/react/cjs/react.development.js:373:16)
    at file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/components/list-tabular.tsx:269:51
    at EventEmitter.eventHandler (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/components/list-data-source.ts:40:16)
    at EventEmitter.emit (node:events:530:35)
    at EventEmitter.emit (node:domain:488:12)
    at ThreadListDataSource.ListDataSource.trigger (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/components/list-data-source.ts:26:19)
    at AnonymousObserver._onNext (file:///tmp/nylas-build/electron-packager/tmp-ucYqkY/resources/app/src/flux/stores/observable-list-data-source.ts:46:12)
    at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.next (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1668:12)
    at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1602:31)
    at AnonymousObserver.tryCatcher (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:67:31)
    at AutoDetachObserverPrototype.next (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:6495:51)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1602:31)
    at InnerObserver.next (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:3353:55)
    at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1602:31)
    at InnerObserver.tryCatcher (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:67:31)
    at AutoDetachObserverPrototype.next (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:6495:51)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1602:31)
    at loopRecursive (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:2250:11)
    at Rx.internals.ScheduledItem.invokeRecImmediate [as action] (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:954:7)
    at Rx.internals.ScheduledItem.ScheduledItem.invokeCore (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:883:33)
    at Rx.internals.ScheduledItem.ScheduledItem.invoke (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:871:40)
    at runTrampoline (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1070:37)
    at tryCatcher (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:67:31)
    at CurrentThreadScheduler.schedule (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1086:45)
    at CombineLatestObservable.Rx.ObservableBase.ObservableBase._subscribe (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1862:32)
    at CombineLatestObservable.Rx.Observable.observableProto.subscribe.observableProto.forEach (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1736:19)
    at SwitchObserver.next (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:3334:35)
    at SwitchObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1602:31)
    at SwitchObserver.tryCatcher (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:67:31)
    at AutoDetachObserverPrototype.next (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:6495:51)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1602:31)
    at InnerObserver.Rx.FlatMapObservable.InnerObserver.next (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1912:14)
    at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1602:31)
    at InnerObserver.tryCatcher (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:67:31)
    at AutoDetachObserverPrototype.next (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:6495:51)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1602:31)
    at InnerObserver.next (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:3353:55)
    at InnerObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1602:31)
    at InnerObserver.tryCatcher (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:67:31)
    at AutoDetachObserverPrototype.next (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:6495:51)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onNext (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1602:31)
    at scheduleNext (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:5086:9)
    at schedule (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1288:53)
    at tryCatcher (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:67:31)
    at runTask (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1172:38)
    at Immediate._onImmediate (/snap/mailspring/546/usr/share/mailspring/resources/app.asar/node_modules/rx-lite/rx.lite.js:1206:36)
    at processImmediate (node:internal/timers:478:21) { pluginIds: [ 'thread-list' ] }