virtua 0.46.0 → 0.46.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -526,6 +526,9 @@ const createVirtualStore = (elementsCount, itemSize = 40, ssrCount = 0, cacheSna
526
526
  }
527
527
  case ACTION_VIEWPORT_RESIZE: {
528
528
  if (viewportSize !== payload) {
529
+ if (!viewportSize) {
530
+ shouldSync = true;
531
+ }
529
532
  viewportSize = payload;
530
533
  mutated = UPDATE_VIRTUAL_STATE + UPDATE_SIZE_EVENT;
531
534
  }
@@ -1115,7 +1118,8 @@ const createWindowResizer = (store, isHorizontal) => {
1115
1118
  store.$update(ACTION_VIEWPORT_RESIZE, window[windowSizeKey]);
1116
1119
  };
1117
1120
  window.addEventListener("resize", onWindowResize);
1118
- onWindowResize();
1121
+ // https://github.com/inokawa/virtua/issues/792
1122
+ microtask(onWindowResize);
1119
1123
  cleanupOnWindowResize = () => {
1120
1124
  window.removeEventListener("resize", onWindowResize);
1121
1125
  };