From 9fb3b71e58cc80dd59b8cf647d72cc116313264b Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Sat, 5 Mar 2022 18:06:26 +0100 Subject: [PATCH] Transition: Fix moving cached virtual elements within tree --- package.json | 4 ++-- src/components/ui/Transition.tsx | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 320834af..d622d36b 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,8 @@ "deploy:production": "npm run build:production && git add -A && git commit -a -m '[Build]' --no-verify && git push", "print_version": "node -p -e \"require('./package.json').version\"", "inc_version": "echo $((`cat .patch-version` + 1)) > .patch-version && echo \"$(node -p -e \"require('./package.json').version.match(/^\\d+\\.\\d+/)[0]\").$(cat .patch-version)\"", - "lint": "tsc && stylelint \"**/*.{css,scss}\" && eslint . --ext .ts,.tsx --ignore-pattern src/lib/gramjs", - "lint:fix": "stylelint . && npm run lint -- --fix", + "check": "tsc && stylelint \"**/*.{css,scss}\" && eslint . --ext .ts,.tsx --ignore-pattern src/lib/gramjs", + "check:fix": "npm run check -- --fix", "gramjs:tl": "node ./src/lib/gramjs/tl/generateModules.js", "gramjs:lint:fix": "eslint ./src/lib/gramjs --fix", "test": "cross-env APP_ENV=test jest --verbose --forceExit", diff --git a/src/components/ui/Transition.tsx b/src/components/ui/Transition.tsx index 90e6f314..49d54c35 100644 --- a/src/components/ui/Transition.tsx +++ b/src/components/ui/Transition.tsx @@ -248,9 +248,8 @@ const Transition: FC = ({ }, [shouldRestoreHeight, children]); const renders = rendersRef.current; - const collection = Object.keys(renderCount ? new Array(renderCount).fill(undefined) : renders).map(Number); - - const contents = collection.map((key) => { + const renderKeys = Object.keys(renderCount ? new Array(renderCount).fill(undefined) : renders).map(Number); + const contents = renderKeys.map((key) => { const render = renders[key]; if (!render) { return undefined; @@ -270,7 +269,7 @@ const Transition: FC = ({ ref={containerRef} id={id} className={buildClassName('Transition', className, name)} - teactFastList={!renderCount && !shouldCleanup} + teactFastList={!renderCount} > {contents}