mirror of
https://github.com/element-hq/element-call.git
synced 2026-10-22 21:53:14 +00:00
Model ConnectionState as a discriminated union
The enum mixed our own lifecycle states with a copy of livekit-client's connection states, and errors were smuggled through the same observable as a separate union member. A discriminated union keeps the LiveKit state nested under "authenticated", carries the error as data, and lets the local member represent the time before a connection exists as an "initializing" state instead of null.
This commit is contained in:
1 parent
3f030e64dd
commit
4e4ab23cda
5 files changed
+134
-97
No files matched your search
@@ -1662,9 +1662,9 @@ export function createCallViewModel$(
|
||||
returnObject.publishError = value.media;
|
||||
else if (
|
||||
typeof value.media === "object" &&
|
||||
value.media.connection instanceof ElementCallError
|
||||
value.media.connection.state === "error"
|
||||
)
|
||||
returnObject.connectionError = value.media.connection;
|
||||
returnObject.connectionError = value.media.connection.error;
|
||||
return returnObject;
|
||||
}),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user