Commit 7c5512d
fix(sdk): re-emit reset on SDK reconnect so Meteor's onReconnect runs
Meteor's accounts-base registers a per-call DDP.onReconnect handler in
callLoginMethod (accounts_client.js:292) that retries login with the
latest stored token and calls makeClientLoggedOut on failure. With our
stub keeping Meteor's connection permanently 'connected', that handler
never fires when the underlying SDK socket reconnects, so server-side
force-logouts (resetUserE2EKey → ws.terminate) leave the user with stale
credentials and no automatic recovery.
Listen for the SDK's 'connected' event in stubMeteorStream and fire
'reset' on every subsequent reconnect — Meteor's _streamHandlers.onReset
then drives _callOnReconnectAndSendAppropriateOutstandingMethods, which
in turn invokes the onReconnect callback. That covers both branches:
- if localStorage was rotated by a concurrent flow, the resume retry
succeeds and setUserId fires;
- if the token is genuinely stale, the resume retry fails and Meteor's
own makeClientLoggedOut clears creds and routes to /login.
Now that Meteor's flow handles the recovery, simplify the
sdk.account.loginWithToken wrap to just swallow the auth-error
rejection (so DDPSDK's `void` auto-relogin doesn't surface as an
unhandled rejection / pageError) — no more deferred cleanup, no
retry-through-Meteor duplication.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent db2a823 commit 7c5512d
2 files changed
Lines changed: 41 additions & 68 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | 138 | | |
154 | 139 | | |
155 | 140 | | |
| |||
236 | 221 | | |
237 | 222 | | |
238 | 223 | | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
239 | 232 | | |
240 | 233 | | |
241 | 234 | | |
242 | | - | |
243 | 235 | | |
244 | 236 | | |
245 | 237 | | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
298 | 244 | | |
299 | 245 | | |
300 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
0 commit comments