element-hq / chatterbox

Chatterbox lets you securely embed Hydrogen on any website!
Apache License 2.0
172 stars 21 forks source link

Make sure AccountSetupViewModel is only created once #106

Open Rhys-T opened 9 months ago

Rhys-T commented 9 months ago

Chatterbox currently creates two instances of AccountSetupViewModel when it is opened for the first time. Each one registers a separate account on the server, and Chatterbox ends up crashing as a result. This change makes Chatterbox reuse the AccountSetupViewModel if it already exists, similarly to what 8aa7ba43ccc5171ccb8b4f1ee5ee55774f3a67c6 added for the ChatterboxViewModel.

Fixes #105.

Wallum commented 8 months ago

I cannot be 100% certain as to whether this is an issue pertaining to this "fix": There is an error occurring on my local implementation of this where it appears there are "timeouts" of the clients and messages are not sent through to the homeserver - this is sporadic and difficult to replicate. Could this "timeout" be related to the double registration issue "fixed" here?