Commit 1499512
authored
fix(grid): inline-edit toggle takes effect immediately + staged editor closes on save (#2151)
* fix(grid): keep lookup inline-edit value after clicking another row
Two independent defects made an inline-edited lookup/reference value
disappear (falling back to the raw id) once the user clicked another row:
1. data-table `startEdit` had no re-entry guard. A lookup option renders in
a Portal, but React synthetic events still bubble through the component
tree back to the cell onClick, re-invoking startEdit for the same cell;
that reset editValue from a not-yet-flushed pendingChanges and clobbered
the freshly picked value. Guard against re-entering the same cell.
2. ObjectGrid's column-building paths dropped reference_to (they copied only
label/currency/precision/scale/format/options) so the read-only
LookupCellRenderer/useLookupName could not resolve the staged id to a
display name. Add applyRelationalMeta() and call it in every path to
forward reference_to/display_field/id_field/etc.
Adds a reproduction test; both fixes are individually load-bearing.
Closes #2150
* fix(grid): inline-edit toggle takes effect immediately + staged editor closes on save
Bug A: toggling 行内编辑 needed a second click to actually make the grid
editable. ListView's memoized grid schema (which sets editable: inlineEdit)
omitted inlineEdit from its deps, so it served the stale value for one toggle.
Add inlineEdit to the dep array so the toggle propagates on the same interaction.
Bug B: after inline-editing a lookup cell and clicking 全部保存, the cell stayed
stuck showing the picker widget. Relational editors (lookup/master_detail/
user/owner) stage their value and deliberately keep the editor open; saveRow/
saveBatch cleared pendingChanges but never cleared editingCell, so the persisted
cell never reverted to its resolved display value. Close any open editor once the
row/batch is saved.
Also: ListView refetches on dataSource.onMutation even when an external
refreshTrigger is present (inline-edit saves go straight through dataSource.update
and only signal via onMutation), and the lookup cell derives its reference key
correctly.
Regression tests: data-table-inline-edit (E), ListView toggle/mutationRefresh,
onMutation, lookupCellReferenceKey.
* fix(grid): refresh list after a bulk/row action succeeds (#2159)
The bottom BulkActionBar's string bulk actions (e.g. 下推 / 派工) and the row
action menu both dispatched via executeAction but never bumped refreshKey, so
the grid kept showing stale data after the server mutation completed — and the
selection toolbar stayed stuck. Only the delete branch (onBulkDelete) and the
rich BulkActionDialog (handleBulkDialogClose) refreshed.
ObjectGrid self-fetches on refreshKey and has no onMutation subscription, and
custom bulk APIs bypass dataSource.update, so nothing else signals a refetch.
On a successful action, reset the selection and bump refreshKey so the list
reflects the server state (mirrors the delete + dialog branches).
Adds bulkActionRefresh.test.tsx driving the full path (header checkbox →
BulkActionBar → dispatchBulkAction → runner handler) against an in-memory fake
server, asserting a refetch + selection reset on success and neither on failure.
* fix(grid): guard inline-edit re-entry with a ref (flaky CI #2150)
The startEdit re-entry guard read the editingCell React state, which can
observe a stale value under batching/contention. Picking a lookup/select
option (rendered in a Portal) bubbles its click back to the cell onClick,
re-invoking startEdit for the same cell; when the guard missed, editValue
was reset from not-yet-flushed pendingChanges and the freshly picked value
was clobbered — the intermittent 'Dev Admin' failure in CI.
Track the active cell in a synchronously-mutated ref and guard on it, so the
re-entrant call within the same event is always caught. Keep the ref in sync
at every edit-exit site.
Also lands the bulkActionDefs-path refresh regression test (#2159).
* fix(fields): cache picked lookup option so its label resolves synchronously
handleSelect now stores the chosen option in pickerResolvedRecords, so
selectedOptions/findOption can resolve the just-picked foreign-key id to
its display label without depending on the popover's transient
fetchedOptions or an async findOne hydration. Fixes the intermittent CI
failure where a freshly-picked lookup value showed no label (#2150).1 parent 4d617a6 commit 1499512
13 files changed
Lines changed: 953 additions & 19 deletions
File tree
- packages
- components/src
- __tests__
- renderers/complex
- data-objectstack/src
- fields/src
- __tests__
- widgets
- plugin-grid/src
- __tests__
- plugin-list/src
- __tests__
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
182 | 218 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
363 | 363 | | |
364 | 364 | | |
365 | 365 | | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
366 | 376 | | |
367 | 377 | | |
368 | 378 | | |
| |||
662 | 672 | | |
663 | 673 | | |
664 | 674 | | |
665 | | - | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
666 | 687 | | |
667 | 688 | | |
668 | | - | |
| 689 | + | |
| 690 | + | |
669 | 691 | | |
670 | 692 | | |
671 | 693 | | |
| |||
703 | 725 | | |
704 | 726 | | |
705 | 727 | | |
| 728 | + | |
706 | 729 | | |
707 | 730 | | |
708 | 731 | | |
709 | 732 | | |
710 | 733 | | |
711 | 734 | | |
| 735 | + | |
712 | 736 | | |
713 | 737 | | |
714 | 738 | | |
| |||
757 | 781 | | |
758 | 782 | | |
759 | 783 | | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
760 | 792 | | |
761 | 793 | | |
762 | 794 | | |
| |||
807 | 839 | | |
808 | 840 | | |
809 | 841 | | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
810 | 848 | | |
811 | 849 | | |
812 | 850 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
403 | 404 | | |
404 | 405 | | |
405 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
406 | 412 | | |
407 | 413 | | |
408 | 414 | | |
| |||
706 | 712 | | |
707 | 713 | | |
708 | 714 | | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
709 | 742 | | |
710 | 743 | | |
711 | 744 | | |
| 745 | + | |
712 | 746 | | |
713 | 747 | | |
714 | 748 | | |
| |||
737 | 771 | | |
738 | 772 | | |
739 | 773 | | |
| 774 | + | |
740 | 775 | | |
741 | 776 | | |
742 | 777 | | |
| |||
762 | 797 | | |
763 | 798 | | |
764 | 799 | | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
765 | 803 | | |
766 | 804 | | |
767 | 805 | | |
| |||
792 | 830 | | |
793 | 831 | | |
794 | 832 | | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
795 | 840 | | |
796 | 841 | | |
797 | 842 | | |
| |||
800 | 845 | | |
801 | 846 | | |
802 | 847 | | |
803 | | - | |
| 848 | + | |
804 | 849 | | |
805 | | - | |
806 | | - | |
| 850 | + | |
| 851 | + | |
807 | 852 | | |
808 | 853 | | |
809 | 854 | | |
| |||
819 | 864 | | |
820 | 865 | | |
821 | 866 | | |
822 | | - | |
| 867 | + | |
823 | 868 | | |
824 | 869 | | |
825 | 870 | | |
| |||
837 | 882 | | |
838 | 883 | | |
839 | 884 | | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
840 | 891 | | |
841 | 892 | | |
842 | 893 | | |
843 | 894 | | |
844 | 895 | | |
845 | 896 | | |
846 | | - | |
| 897 | + | |
847 | 898 | | |
848 | | - | |
| 899 | + | |
849 | 900 | | |
850 | | - | |
| 901 | + | |
851 | 902 | | |
852 | 903 | | |
853 | 904 | | |
| |||
863 | 914 | | |
864 | 915 | | |
865 | 916 | | |
866 | | - | |
| 917 | + | |
867 | 918 | | |
868 | 919 | | |
869 | 920 | | |
| |||
0 commit comments