Commit a1fd13c
perf(datasource-editor): fix typing lag and scrambling in form fields
Typing into any Dataset Editor text field (Settings → Basic Description,
column descriptions, metric labels, SQL expressions) was visibly slow on
realistic datasets because every keystroke re-rendered all seven tabs'
contents and ran synchronous O(n) validation inside the setState
callback. On fast typing or East-Asian IME input, characters landed in
the DOM in the order renders finished rather than the order typed,
manifesting as "scrambled" input. See sc-104866 for the full diagnosis.
Four coordinated changes in two files:
1. Debounce validate + flush on blur. Validation (duplicate-name checks,
currency format, folder consistency) is moved off the keystroke hot
path via lodash debounce (300 ms window). A new flushValidation method
is exposed as onBlur on the DatasourceContainer wrapper so focus
leaving any field flushes pending validation synchronously, keeping
the Save-button error gate accurate (errors.length > 0 disables save).
componentWillUnmount cancels the pending invocation to avoid
setState-on-unmounted warnings.
2. Lazy-mount hidden tabs via destroyInactiveTabPane so only the visible
tab's children are mounted. Eliminates the largest source of
per-keystroke render cost on wide datasets where ColumnCollectionTable
and MetricsTab would otherwise re-render on every setState.
3. Memoise derived arrays (sortedMetrics, datetimeColumns, stringColumns)
with one-pair (lastInput, lastOutput) caches so downstream
PureComponent / React.memo children stop re-rendering on unrelated
state changes. Also hoist three inline itemGenerator={() => ({...})}
lambdas to stable class-field arrow functions (newSpatialItem,
newMetricItem, newCalculatedColumnItem).
4. IME composition guards in TextAreaControl. Track isComposing state via
onCompositionStart / onCompositionEnd, skip handleChange while
composing, propagate once on compositionend. Reduces per-IME-word
work from N candidate events to one commit. Also converts handleChange
to an arrow class field so onChange={this.handleChange} has stable
identity across renders (no more .bind(this) in render).
Validation semantics are preserved (FR-008): same validators, same error
messages, same Save-button gate — only the schedule changes.
Existing 34 Jest tests across DatasourceEditor, DatasourceEditorCurrency,
and TextAreaControl pass unmodified. Playwright coverage for SC-001,
SC-003, and SC-005 deferred to a follow-up commit.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4c4905f commit a1fd13c
2 files changed
Lines changed: 157 additions & 33 deletions
File tree
- superset-frontend/src
- components/Datasource/components/DatasourceEditor
- explore/components/controls
Lines changed: 125 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
895 | 896 | | |
896 | 897 | | |
897 | 898 | | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
898 | 918 | | |
899 | 919 | | |
900 | 920 | | |
| |||
990 | 1010 | | |
991 | 1011 | | |
992 | 1012 | | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
993 | 1022 | | |
994 | 1023 | | |
995 | 1024 | | |
| |||
1081 | 1110 | | |
1082 | 1111 | | |
1083 | 1112 | | |
1084 | | - | |
| 1113 | + | |
1085 | 1114 | | |
1086 | 1115 | | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
1087 | 1120 | | |
1088 | 1121 | | |
1089 | 1122 | | |
| |||
1464 | 1497 | | |
1465 | 1498 | | |
1466 | 1499 | | |
1467 | | - | |
1468 | | - | |
1469 | | - | |
1470 | | - | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
| 1503 | + | |
| 1504 | + | |
| 1505 | + | |
| 1506 | + | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
| 1512 | + | |
| 1513 | + | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + | |
| 1517 | + | |
1471 | 1518 | | |
1472 | | - | |
1473 | | - | |
| 1519 | + | |
| 1520 | + | |
| 1521 | + | |
| 1522 | + | |
| 1523 | + | |
| 1524 | + | |
| 1525 | + | |
| 1526 | + | |
| 1527 | + | |
| 1528 | + | |
| 1529 | + | |
1474 | 1530 | | |
1475 | 1531 | | |
1476 | 1532 | | |
1477 | 1533 | | |
1478 | 1534 | | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
1479 | 1538 | | |
1480 | | - | |
1481 | | - | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
1482 | 1550 | | |
1483 | 1551 | | |
1484 | 1552 | | |
| |||
1488 | 1556 | | |
1489 | 1557 | | |
1490 | 1558 | | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
| 1580 | + | |
| 1581 | + | |
| 1582 | + | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
| 1594 | + | |
1491 | 1595 | | |
1492 | 1596 | | |
1493 | 1597 | | |
| |||
1708 | 1812 | | |
1709 | 1813 | | |
1710 | 1814 | | |
1711 | | - | |
1712 | | - | |
1713 | | - | |
1714 | | - | |
1715 | | - | |
| 1815 | + | |
1716 | 1816 | | |
1717 | 1817 | | |
1718 | 1818 | | |
| |||
2148 | 2248 | | |
2149 | 2249 | | |
2150 | 2250 | | |
2151 | | - | |
| 2251 | + | |
2152 | 2252 | | |
2153 | 2253 | | |
2154 | 2254 | | |
| |||
2271 | 2371 | | |
2272 | 2372 | | |
2273 | 2373 | | |
2274 | | - | |
2275 | | - | |
2276 | | - | |
2277 | | - | |
2278 | | - | |
| 2374 | + | |
2279 | 2375 | | |
2280 | 2376 | | |
2281 | 2377 | | |
| |||
2349 | 2445 | | |
2350 | 2446 | | |
2351 | 2447 | | |
2352 | | - | |
| 2448 | + | |
2353 | 2449 | | |
2354 | 2450 | | |
2355 | | - | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
2356 | 2455 | | |
2357 | 2456 | | |
2358 | 2457 | | |
| |||
2372 | 2471 | | |
2373 | 2472 | | |
2374 | 2473 | | |
| 2474 | + | |
2375 | 2475 | | |
2376 | 2476 | | |
2377 | 2477 | | |
| |||
2479 | 2579 | | |
2480 | 2580 | | |
2481 | 2581 | | |
2482 | | - | |
2483 | | - | |
2484 | | - | |
2485 | | - | |
2486 | | - | |
2487 | | - | |
2488 | | - | |
| 2582 | + | |
2489 | 2583 | | |
2490 | 2584 | | |
2491 | 2585 | | |
| |||
2627 | 2721 | | |
2628 | 2722 | | |
2629 | 2723 | | |
| 2724 | + | |
| 2725 | + | |
2630 | 2726 | | |
2631 | 2727 | | |
2632 | 2728 | | |
| |||
Lines changed: 32 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
107 | 112 | | |
108 | 113 | | |
109 | 114 | | |
110 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
111 | 134 | | |
112 | 135 | | |
113 | 136 | | |
| |||
124 | 147 | | |
125 | 148 | | |
126 | 149 | | |
127 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
128 | 154 | | |
129 | 155 | | |
130 | 156 | | |
131 | 157 | | |
132 | 158 | | |
133 | 159 | | |
134 | | - | |
| 160 | + | |
135 | 161 | | |
136 | 162 | | |
137 | 163 | | |
| |||
211 | 237 | | |
212 | 238 | | |
213 | 239 | | |
214 | | - | |
| 240 | + | |
215 | 241 | | |
216 | 242 | | |
217 | 243 | | |
| |||
226 | 252 | | |
227 | 253 | | |
228 | 254 | | |
229 | | - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
230 | 258 | | |
231 | 259 | | |
232 | 260 | | |
| |||
0 commit comments