Commit e5ae445
authored
improvement(tables): announce locks on open instead of a header chip (#5979)
* improvement(tables): announce locks on open instead of a header chip
Drop the lock entry from the table header actions. A locked table now announces
itself once on open via an info toast carrying the Lock settings action for
admins; the breadcrumb dropdown remains the permanent entry point.
* fix(tables): wait for permissions before announcing table locks
The lock announcement fires once per table, so a canAdmin that is still false
because permissions have not resolved permanently drops the toast's Lock
settings action. Arm the one-shot on the permissions decision rather than on
table resolution.
* fix(tables): keep the lock announcement from being swept on navigation
The toast provider clears route-scoped toasts in a pathname effect that runs
after child effects, so an announcement fired on a warm-cache navigation was
added and removed in the same commit. Opt these toasts out of the sweep and
dismiss them on unmount so they still don't trail the user.
* fix(tables): drop the lock notice when its action stops being valid
A toast's action is captured at creation, so a viewer whose admin access is
revoked while the announcement is on screen kept a Lock settings button that
opened nothing. Dismiss the notice when the action is no longer available.
* fix(tables): only drop the lock notice when access is actually lost
The dismiss effect treated "has no access" the same as "just lost access", so
on a warm-cache mount — where the announcement and the dismiss both run in the
mount commit — a non-admin's notice was torn down the moment it was created.
Dismiss on the true-to-false transition only.
* fix(tables): clear the lock notice when switching tables
Switching tables reuses this component rather than remounting it, and the
notice is exempt from the provider's route sweep, so a locked table's
announcement stayed on screen over the next table — where its action would
have opened that table's lock settings instead. Key the cleanup on tableId.
* fix(emcn): sweep route-scoped toasts during render, not after child effects
The provider cleared route-scoped toasts from a pathname effect. Effects run
child-first, so it also swept toasts the newly rendered route had just raised:
any toast added from a child's mount effect — which is what happens whenever
that child's data is already cached — was appended and filtered out in the same
commit, before it painted.
Move the sweep into render, where it runs before children render, so only
toasts predating the navigation are cleared. Timers and heights were already
reconciled by effects keyed off `toasts`, so this stays a pure state update.
Drops the persistAcrossRoutes workaround the table lock notice needed to dodge
the bug; its tableId-keyed cleanup stays, covering embedded swaps that change
the prop without a route change.
* fix(tables): reset the announce latch when leaving a table
The tableId cleanup dismissed the notice on departure but left the latch
holding that table's id, so returning before another table announced — a quick
there-and-back, or a second table that never loaded — found the latch matching
and stayed silent. Leaving ends the visit, so clear the latch with it.1 parent b148a52 commit e5ae445
3 files changed
Lines changed: 73 additions & 60 deletions
File tree
- apps/sim/app/workspace/[workspaceId]/tables/[tableId]
- packages/emcn/src/components/toast
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | | - | |
| 2 | + | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
| 79 | + | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
Lines changed: 46 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
| 64 | + | |
70 | 65 | | |
71 | 66 | | |
72 | 67 | | |
| |||
627 | 622 | | |
628 | 623 | | |
629 | 624 | | |
630 | | - | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
631 | 629 | | |
632 | 630 | | |
633 | 631 | | |
| |||
641 | 639 | | |
642 | 640 | | |
643 | 641 | | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
644 | 681 | | |
645 | 682 | | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | 683 | | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | 684 | | |
662 | 685 | | |
663 | 686 | | |
| |||
673 | 696 | | |
674 | 697 | | |
675 | 698 | | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
| 699 | + | |
684 | 700 | | |
685 | 701 | | |
686 | 702 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
396 | 396 | | |
397 | 397 | | |
398 | 398 | | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
399 | 422 | | |
400 | 423 | | |
401 | 424 | | |
| |||
459 | 482 | | |
460 | 483 | | |
461 | 484 | | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | 485 | | |
484 | 486 | | |
485 | 487 | | |
| |||
536 | 538 | | |
537 | 539 | | |
538 | 540 | | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | 541 | | |
545 | 542 | | |
546 | 543 | | |
| |||
0 commit comments