Commit 733fd63
fix(authenticator): apply UI config when signing out before init (#7083)
* fix(authenticator): apply UI config when signing out before init
The machine parks in `setup.initConfig` until the UI sends `INIT`, which
carries the `config` and `services` passed to the `Authenticator`.
`initConfig` also handles `SIGN_OUT`, and the sign out actor completing
targeted `setup.getConfig` unconditionally, skipping `initConfig` and the
`configure` action. The machine then settled on `signIn`, so
`useAuthenticatorInitMachine` never sent `INIT` and every prop passed to
the `Authenticator` was dropped.
Return to `setup` when setup has not completed, so the machine waits for
`INIT` again. `hasSetup` is only set after `getConfig` resolves, so the
normal sign out path is unchanged.
Fixes #6967
* fix(authenticator): accept INIT after setup instead of rerouting sign out
Returning to `setup.initConfig` after signing out before init broke headless
usage. `examples/svelte` .../useAuthenticator/home navigates off
`route === 'signIn'`, which the machine no longer reached, so the e2e
`Headless Usage` scenario timed out waiting for the sign in form.
Leave the sign out transition alone and fix the initialization path instead.
`configure` now records that the UI has configured the machine, and `INIT` is
accepted at the root until it has, so an `Authenticator` rendered after the
machine has already moved past setup can still apply its `config` and
`services`. `useAuthenticatorInitMachine` sends `INIT` on any route other than
`idle`, which has to resolve `handleGetCurrentUser` first.
---------
Co-authored-by: Philipp Andreas Paul <phandpau@amazon.de>1 parent 146ba6d commit 733fd63
6 files changed
Lines changed: 165 additions & 27 deletions
File tree
- .changeset
- packages
- react-core/src/Authenticator/hooks/useAuthenticatorInitMachine
- __tests__
- ui/src/machines/authenticator
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
54 | 70 | | |
55 | 71 | | |
56 | 72 | | |
| |||
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
18 | 22 | | |
19 | 23 | | |
20 | 24 | | |
| |||
Lines changed: 120 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
14 | 24 | | |
15 | 25 | | |
16 | 26 | | |
| |||
486 | 496 | | |
487 | 497 | | |
488 | 498 | | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
| 499 | + | |
498 | 500 | | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
510 | 526 | | |
511 | 527 | | |
512 | 528 | | |
513 | 529 | | |
514 | 530 | | |
515 | 531 | | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
516 | 536 | | |
517 | 537 | | |
518 | 538 | | |
519 | 539 | | |
520 | 540 | | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
521 | 588 | | |
522 | | - | |
| 589 | + | |
| 590 | + | |
523 | 591 | | |
524 | 592 | | |
525 | 593 | | |
526 | | - | |
| 594 | + | |
527 | 595 | | |
| 596 | + | |
| 597 | + | |
528 | 598 | | |
529 | | - | |
530 | | - | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
531 | 620 | | |
532 | 621 | | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
533 | 626 | | |
534 | | - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
535 | 630 | | |
536 | 631 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
312 | 320 | | |
313 | 321 | | |
314 | 322 | | |
| |||
424 | 432 | | |
425 | 433 | | |
426 | 434 | | |
| 435 | + | |
427 | 436 | | |
428 | 437 | | |
429 | 438 | | |
| |||
435 | 444 | | |
436 | 445 | | |
437 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
438 | 451 | | |
439 | 452 | | |
440 | 453 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
168 | 170 | | |
169 | 171 | | |
170 | 172 | | |
| |||
0 commit comments