From 37d992cc104725f59f6cf4a0fcb036cfff898c83 Mon Sep 17 00:00:00 2001 From: Hirbod <504909+hirbod@users.noreply.github.com> Date: Mon, 4 Jul 2022 17:25:25 +0200 Subject: [PATCH] fix: optional chaining for clearAll (#725) * fix: optional chaining for clearAll * Update VirtualRenderer.ts * Update VirtualRenderer.ts --- src/core/VirtualRenderer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/VirtualRenderer.ts b/src/core/VirtualRenderer.ts index dd3297a2..d5ae0af4 100644 --- a/src/core/VirtualRenderer.ts +++ b/src/core/VirtualRenderer.ts @@ -263,9 +263,9 @@ export default class VirtualRenderer { const newRenderStack: RenderStack = {}; const keyToStableIdMap: { [key: string]: string } = {}; - // Do not use recycle pool so that elements don't fly top to bottom or vice version + // Do not use recycle pool so that elements don't fly top to bottom or vice versa // Doing this is expensive and can draw extra items - if (this._optimizeForAnimations) { + if (this._optimizeForAnimations && this._recyclePool) { this._recyclePool.clearAll(); }