Perf: Eliminate first-scroll unresponsiveness

This commit is contained in:
AI Engineer 2026-05-22 19:30:05 +08:00
parent e8d8e17b7d
commit 667b08c895
2 changed files with 4 additions and 5 deletions

View File

@ -34,3 +34,4 @@
- Successfully decoupled dynamic UI states (like `.dt-cell-selected`) from the declarative binding framework. We now use manual DOM manipulation (`applySelectionUI`) during `refresh` to sync states. - Successfully decoupled dynamic UI states (like `.dt-cell-selected`) from the declarative binding framework. We now use manual DOM manipulation (`applySelectionUI`) during `refresh` to sync states.
- This manual sync completely prevents "Dependency Floods" where scrolling would trigger heavy `$class` evaluations on every cell. We maintained the Zero-Scan status while supporting rich interactions. - This manual sync completely prevents "Dependency Floods" where scrolling would trigger heavy `$class` evaluations on every cell. We maintained the Zero-Scan status while supporting rich interactions.
- Fixed a VirtualScroll jumping bug at row 70+ by re-enabling `onItemUpdate` so VirtualScroll correctly learns the 40px row height instead of using its 32px default. - Fixed a VirtualScroll jumping bug at row 70+ by re-enabling `onItemUpdate` so VirtualScroll correctly learns the 40px row height instead of using its 32px default.
- **Scroll Initiation Fix**: Removed the `setTimeout` wrapper around `vs.init` during `reset`. Previously, the first scroll often hit a "blank wall" because VirtualScroll's internal metrics hadn't finished initializing when the user made their first swift scroll motion. Synchronous initialization resolved this completely.

View File

@ -30,11 +30,9 @@ export const createScrollManager = (container, state, onRenderedListChange) => {
reset: (list) => { reset: (list) => {
state._listStartIndex = 0; state._listStartIndex = 0;
state._renderedList = vs.reset(list, scrollEl || container) || []; state._renderedList = vs.reset(list, scrollEl || container) || [];
setTimeout(() => {
if (state.list === list) { if (state.list === list) {
vs.init(list, refresh); vs.init(list, refresh);
} }
});
}, },
updateRowHeight: (index, node) => { updateRowHeight: (index, node) => {
// Restore this call so VirtualScroll can learn the actual height // Restore this call so VirtualScroll can learn the actual height