Commit 841c0d2
committed
fix(sdk): replace broken Accounts.loggingIn gate with sdk.account poll
The previous `Accounts.loggingIn?.()` gate threw at runtime
('Cannot read properties of undefined reading _loggingIn') because it
was called as a free reference and lost its `this` binding. The throw
was caught silently by runUserDataSync's try/catch, which meant the
gate never actually ran — boot timing happened to work because the
microtask between the throw and synchronizeUserData's stream subscribe
gave adopt enough time to populate sdk.account.
Replace it with an explicit ~500ms poll on sdk.account.uid. If the
Meteor-routed resume login (via stubMeteorStream → SDK socket → adopt)
completes within the window, we short-circuit and avoid issuing a
duplicate loginWithToken on the same socket — the duplicate causes a
second Presence connection, the aggregate stays online instead of
flipping to away, and the omnichannel idle/away tests fail. If adopt
doesn't fire in time, fall back to our own loginWithToken (existing
inflightLogin gate keeps it idempotent).
Verified: login, account-login, e2ee-key-reset and the full
omnichannel-rooms-forward suite pass locally.1 parent 26cebbe commit 841c0d2
1 file changed
Lines changed: 11 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
104 | 99 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | 100 | | |
109 | 101 | | |
110 | 102 | | |
| |||
0 commit comments