@react-stately/virtualizer
Advanced tools
Comparing version 3.7.2-nightly.4718 to 3.7.2-nightly.4723
@@ -41,4 +41,7 @@ var $abed55ea619a7a17$exports = require("./utils.main.js"); | ||
} | ||
getParentView(layoutInfo) { | ||
return layoutInfo.parentKey != null ? this._visibleViews.get(layoutInfo.parentKey) : this._rootView; | ||
} | ||
getReusableView(layoutInfo) { | ||
let parentView = layoutInfo.parentKey != null ? this._visibleViews.get(layoutInfo.parentKey) : this._rootView; | ||
let parentView = this.getParentView(layoutInfo); | ||
let view = parentView.getReusableView(layoutInfo.type); | ||
@@ -105,6 +108,10 @@ view.layoutInfo = layoutInfo; | ||
let removed = new Set(); | ||
for (let [key, view] of this._visibleViews)if (!visibleLayoutInfos.has(key)) { | ||
this._visibleViews.delete(key); | ||
view.parent.reuseChild(view); | ||
removed.add(view); // Defer removing in case we reuse this view. | ||
for (let [key, view] of this._visibleViews){ | ||
let layoutInfo = visibleLayoutInfos.get(key); | ||
// If a view's parent changed, treat it as a delete and re-create in the new parent. | ||
if (!layoutInfo || view.parent !== this.getParentView(layoutInfo)) { | ||
this._visibleViews.delete(key); | ||
view.parent.reuseChild(view); | ||
removed.add(view); // Defer removing in case we reuse this view. | ||
} | ||
} | ||
@@ -111,0 +118,0 @@ for (let [key, layoutInfo] of visibleLayoutInfos){ |
@@ -35,4 +35,7 @@ import {isSetEqual as $fc36f9a046a9ce79$export$a8d0d0c8d1c5df64} from "./utils.module.js"; | ||
} | ||
getParentView(layoutInfo) { | ||
return layoutInfo.parentKey != null ? this._visibleViews.get(layoutInfo.parentKey) : this._rootView; | ||
} | ||
getReusableView(layoutInfo) { | ||
let parentView = layoutInfo.parentKey != null ? this._visibleViews.get(layoutInfo.parentKey) : this._rootView; | ||
let parentView = this.getParentView(layoutInfo); | ||
let view = parentView.getReusableView(layoutInfo.type); | ||
@@ -99,6 +102,10 @@ view.layoutInfo = layoutInfo; | ||
let removed = new Set(); | ||
for (let [key, view] of this._visibleViews)if (!visibleLayoutInfos.has(key)) { | ||
this._visibleViews.delete(key); | ||
view.parent.reuseChild(view); | ||
removed.add(view); // Defer removing in case we reuse this view. | ||
for (let [key, view] of this._visibleViews){ | ||
let layoutInfo = visibleLayoutInfos.get(key); | ||
// If a view's parent changed, treat it as a delete and re-create in the new parent. | ||
if (!layoutInfo || view.parent !== this.getParentView(layoutInfo)) { | ||
this._visibleViews.delete(key); | ||
view.parent.reuseChild(view); | ||
removed.add(view); // Defer removing in case we reuse this view. | ||
} | ||
} | ||
@@ -105,0 +112,0 @@ for (let [key, layoutInfo] of visibleLayoutInfos){ |
{ | ||
"name": "@react-stately/virtualizer", | ||
"version": "3.7.2-nightly.4718+4b27a0c02", | ||
"version": "3.7.2-nightly.4723+9b48ec5d5", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,4 +25,4 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@react-aria/utils": "3.0.0-nightly.3006+4b27a0c02", | ||
"@react-types/shared": "3.0.0-nightly.3006+4b27a0c02", | ||
"@react-aria/utils": "3.0.0-nightly.3011+9b48ec5d5", | ||
"@react-types/shared": "3.0.0-nightly.3011+9b48ec5d5", | ||
"@swc/helpers": "^0.5.0" | ||
@@ -36,3 +36,3 @@ }, | ||
}, | ||
"gitHead": "4b27a0c027f4fbab9ed1070c748966c902b13429" | ||
"gitHead": "9b48ec5d528adeba1a96592945459726def7ba56" | ||
} |
@@ -104,4 +104,8 @@ /* | ||
private getParentView(layoutInfo: LayoutInfo): ReusableView<T, V> | undefined { | ||
return layoutInfo.parentKey != null ? this._visibleViews.get(layoutInfo.parentKey) : this._rootView; | ||
} | ||
private getReusableView(layoutInfo: LayoutInfo): ReusableView<T, V> { | ||
let parentView = layoutInfo.parentKey != null ? this._visibleViews.get(layoutInfo.parentKey) : this._rootView; | ||
let parentView = this.getParentView(layoutInfo)!; | ||
let view = parentView.getReusableView(layoutInfo.type); | ||
@@ -198,3 +202,5 @@ view.layoutInfo = layoutInfo; | ||
for (let [key, view] of this._visibleViews) { | ||
if (!visibleLayoutInfos.has(key)) { | ||
let layoutInfo = visibleLayoutInfos.get(key); | ||
// If a view's parent changed, treat it as a delete and re-create in the new parent. | ||
if (!layoutInfo || view.parent !== this.getParentView(layoutInfo)) { | ||
this._visibleViews.delete(key); | ||
@@ -201,0 +207,0 @@ view.parent.reuseChild(view); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
278086
3519