Commit 01deeab
committed
refactor(table): consolidate exec-status helpers + fix N-running counter
Cleanup pass on the recent table changes — pulls duplicated predicates and
SQL snippets into shared helpers and fixes one drift bug along the way.
- isExecInFlight: now single export from lib/table/deps.ts. Removed the
duplicate in components/table-grid/utils.ts. Used by isGroupEligible
(server eligibility) and runningByRowId (client counter).
- isOptimisticInFlight: kept local to hooks/queries/tables.ts — renamed from
isInFlight to disambiguate from the stricter isExecInFlight. The two
predicates differ on `pending` without a jobId: optimistic patches and
poll-trigger want the broader version, eligibility wants the strict one.
- areOutputsFilled: single export from lib/table/deps.ts, dropped duplicate
from workflow-columns.ts.
- classifyExecStatusMix: shared row × group walker in table-grid/utils.ts.
Replaces two copies of the same loop in table-grid.tsx (selectionStats +
contextMenuStats). Both surfaces now have the same short-circuit
semantics, including the seen-all-selected-rows early break that
contextMenuStats was missing.
- stripGroupExecutions: SQL helper in service.ts. Replaces three copies of
the `UPDATE user_table_rows SET executions = executions - $gid::text`
pattern across deleteColumn / deleteColumns / deleteWorkflowGroup.
Drift bug:
- runningByRowId / totalRunning counted only `running` and `queued`. Every
other in-flight check in the codebase treats post-stamp `pending` as
in-flight too, so the page-header "N running" badge briefly dropped to 0
between scheduler stamp and worker pickup. Now uses isExecInFlight.1 parent 036db43 commit 01deeab
6 files changed
Lines changed: 125 additions & 123 deletions
File tree
- apps/sim
- app/workspace/[workspaceId]/tables/[tableId]/components/table-grid
- hooks/queries
- lib/table
Lines changed: 17 additions & 61 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
| 52 | + | |
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
| |||
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
| 121 | + | |
124 | 122 | | |
125 | 123 | | |
126 | 124 | | |
| |||
2569 | 2567 | | |
2570 | 2568 | | |
2571 | 2569 | | |
2572 | | - | |
2573 | | - | |
| 2570 | + | |
2574 | 2571 | | |
2575 | 2572 | | |
2576 | 2573 | | |
| |||
2671 | 2668 | | |
2672 | 2669 | | |
2673 | 2670 | | |
2674 | | - | |
2675 | | - | |
2676 | | - | |
2677 | | - | |
2678 | | - | |
2679 | | - | |
2680 | | - | |
2681 | | - | |
2682 | | - | |
2683 | | - | |
2684 | | - | |
2685 | | - | |
2686 | | - | |
2687 | | - | |
2688 | | - | |
2689 | | - | |
2690 | | - | |
2691 | | - | |
2692 | | - | |
2693 | | - | |
2694 | | - | |
2695 | | - | |
2696 | | - | |
2697 | | - | |
| 2671 | + | |
| 2672 | + | |
| 2673 | + | |
| 2674 | + | |
| 2675 | + | |
| 2676 | + | |
2698 | 2677 | | |
2699 | 2678 | | |
2700 | 2679 | | |
| |||
2730 | 2709 | | |
2731 | 2710 | | |
2732 | 2711 | | |
2733 | | - | |
2734 | | - | |
2735 | | - | |
2736 | | - | |
2737 | | - | |
2738 | | - | |
2739 | | - | |
2740 | | - | |
2741 | | - | |
2742 | | - | |
2743 | | - | |
2744 | | - | |
2745 | | - | |
2746 | | - | |
2747 | | - | |
2748 | | - | |
2749 | | - | |
2750 | | - | |
2751 | | - | |
2752 | | - | |
2753 | | - | |
2754 | | - | |
2755 | | - | |
2756 | | - | |
2757 | | - | |
2758 | | - | |
2759 | | - | |
2760 | | - | |
| 2712 | + | |
| 2713 | + | |
2761 | 2714 | | |
2762 | | - | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
2763 | 2719 | | |
2764 | 2720 | | |
2765 | 2721 | | |
| |||
Lines changed: 45 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
135 | 171 | | |
136 | 172 | | |
137 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 81 | + | |
84 | 82 | | |
85 | 83 | | |
86 | 84 | | |
| |||
825 | 823 | | |
826 | 824 | | |
827 | 825 | | |
828 | | - | |
829 | | - | |
| 826 | + | |
830 | 827 | | |
831 | 828 | | |
832 | 829 | | |
| |||
1138 | 1135 | | |
1139 | 1136 | | |
1140 | 1137 | | |
1141 | | - | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
1142 | 1143 | | |
1143 | 1144 | | |
1144 | 1145 | | |
| |||
1173 | 1174 | | |
1174 | 1175 | | |
1175 | 1176 | | |
1176 | | - | |
| 1177 | + | |
1177 | 1178 | | |
1178 | 1179 | | |
1179 | 1180 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
9 | 39 | | |
10 | 40 | | |
11 | 41 | | |
| |||
97 | 127 | | |
98 | 128 | | |
99 | 129 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1598 | 1598 | | |
1599 | 1599 | | |
1600 | 1600 | | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
| 1612 | + | |
| 1613 | + | |
| 1614 | + | |
| 1615 | + | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
1601 | 1619 | | |
1602 | 1620 | | |
1603 | 1621 | | |
| |||
2425 | 2443 | | |
2426 | 2444 | | |
2427 | 2445 | | |
2428 | | - | |
2429 | | - | |
2430 | | - | |
2431 | | - | |
2432 | | - | |
2433 | | - | |
2434 | | - | |
2435 | | - | |
2436 | | - | |
| 2446 | + | |
2437 | 2447 | | |
2438 | 2448 | | |
2439 | 2449 | | |
| |||
2536 | 2546 | | |
2537 | 2547 | | |
2538 | 2548 | | |
2539 | | - | |
2540 | | - | |
2541 | | - | |
2542 | | - | |
2543 | | - | |
2544 | | - | |
2545 | | - | |
| 2549 | + | |
2546 | 2550 | | |
2547 | 2551 | | |
2548 | 2552 | | |
| |||
3443 | 3447 | | |
3444 | 3448 | | |
3445 | 3449 | | |
3446 | | - | |
3447 | | - | |
3448 | | - | |
| 3450 | + | |
3449 | 3451 | | |
3450 | 3452 | | |
3451 | 3453 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | 40 | | |
54 | 41 | | |
55 | 42 | | |
| |||
70 | 57 | | |
71 | 58 | | |
72 | 59 | | |
| 60 | + | |
73 | 61 | | |
74 | | - | |
75 | | - | |
76 | 62 | | |
77 | 63 | | |
78 | 64 | | |
| |||
0 commit comments