Commit 44d336b
authored
fix(auth): remove visibilitychange listener from IndexedDBLocalPersistence (#10300)
Fixes #10264.
PR #10123 introduced pagehide, pageshow, and visibilitychange listeners to prevent null hydration during page reload. However, visibilitychange fires with document.visibilityState === 'hidden' whenever focus shifts to an OAuth popup window (e.g. signInWithPopup) or background tab. This caused IndexedDB to close prematurely and throw 'Database is closing/hidden' when the popup returned credentials to the opener.
This change:
1. Removes the visibilitychange listener from IndexedDBLocalPersistence, relying solely on pagehide/pageshow for true page teardown lifecycle events.
2. Renames isHiding -> isClosing to accurately reflect its purpose.
3. Updates unit tests to assert that visibilitychange does not close the DB or interrupt persistence writes.1 parent 19693de commit 44d336b
3 files changed
Lines changed: 28 additions & 46 deletions
File tree
- .changeset
- packages/auth/src/platform_browser/persistence
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 13 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | | - | |
| 442 | + | |
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
| 455 | + | |
455 | 456 | | |
456 | 457 | | |
457 | 458 | | |
458 | 459 | | |
| 460 | + | |
459 | 461 | | |
460 | 462 | | |
461 | 463 | | |
| |||
468 | 470 | | |
469 | 471 | | |
470 | 472 | | |
471 | | - | |
| 473 | + | |
472 | 474 | | |
473 | 475 | | |
474 | 476 | | |
| |||
479 | 481 | | |
480 | 482 | | |
481 | 483 | | |
482 | | - | |
| 484 | + | |
483 | 485 | | |
484 | 486 | | |
485 | 487 | | |
| |||
488 | 490 | | |
489 | 491 | | |
490 | 492 | | |
491 | | - | |
| 493 | + | |
492 | 494 | | |
| 495 | + | |
493 | 496 | | |
494 | | - | |
| 497 | + | |
495 | 498 | | |
496 | 499 | | |
497 | 500 | | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
| 501 | + | |
507 | 502 | | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
508 | 507 | | |
509 | 508 | | |
510 | 509 | | |
| |||
Lines changed: 10 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
190 | | - | |
| 189 | + | |
| 190 | + | |
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | 197 | | |
208 | 198 | | |
209 | 199 | | |
| |||
212 | 202 | | |
213 | 203 | | |
214 | 204 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | 205 | | |
222 | 206 | | |
223 | 207 | | |
| |||
228 | 212 | | |
229 | 213 | | |
230 | 214 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | 215 | | |
238 | 216 | | |
239 | 217 | | |
| |||
246 | 224 | | |
247 | 225 | | |
248 | 226 | | |
249 | | - | |
250 | | - | |
| 227 | + | |
| 228 | + | |
251 | 229 | | |
252 | 230 | | |
253 | 231 | | |
| |||
267 | 245 | | |
268 | 246 | | |
269 | 247 | | |
270 | | - | |
| 248 | + | |
271 | 249 | | |
272 | 250 | | |
273 | 251 | | |
| |||
425 | 403 | | |
426 | 404 | | |
427 | 405 | | |
428 | | - | |
| 406 | + | |
429 | 407 | | |
430 | 408 | | |
431 | 409 | | |
| |||
435 | 413 | | |
436 | 414 | | |
437 | 415 | | |
438 | | - | |
| 416 | + | |
439 | 417 | | |
440 | 418 | | |
441 | 419 | | |
| |||
469 | 447 | | |
470 | 448 | | |
471 | 449 | | |
472 | | - | |
| 450 | + | |
473 | 451 | | |
474 | 452 | | |
475 | 453 | | |
| |||
0 commit comments