From 5928209aedae8a030cda53ed6624d9c044d8cf76 Mon Sep 17 00:00:00 2001 From: Dominik Guzei Date: Wed, 25 Nov 2020 12:19:26 +0100 Subject: [PATCH] [DDW-426] Wrong transaction height when filtering (#2249) * [DDW-426] Estimate row heights in render method The bug (expanded txs with wrong height in the virtual list) might have been caused by estimating the rows too late (in componentDidUpdate) when the virtual list already was setup. This change moves the estimation logic into the render before the virtual list is created. Hopefully this will resolve this issue * [DDW-426] Add changelog entry Co-authored-by: Nikola Glumac --- CHANGELOG.md | 9 +++++---- .../render-strategies/VirtualTransactionList.js | 11 ++++++----- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dbc3a1e8d..8ad69009e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ Changelog - Improved form field feedback UX ([PR 2241](https://github.com/input-output-hk/daedalus/pull/2241)) - Implemented "Filter and CSV export" feature on the "Transactions" screen ([PR 2207](https://github.com/input-output-hk/daedalus/pull/2207)) +### Fixes + +- Fixed visual glitch on the transaction list switching between filters ([PR 2249](https://github.com/input-output-hk/daedalus/pull/2249)) +- Fixed Newsfeed drop shadow when there is an update item ([PR 2242](https://github.com/input-output-hk/daedalus/pull/2242)) + ### Chores - Implemented Smart Tooltips across whole application ([PR 2243](https://github.com/input-output-hk/daedalus/pull/2243)) @@ -16,10 +21,6 @@ Changelog - Implemented a tool for quickly copying css properties on theme files ([PR 2196](https://github.com/input-output-hk/daedalus/pull/2196)) - Hid hardware wallet restoration support ([PR 2237](https://github.com/input-output-hk/daedalus/pull/2237)) -### Fixes - -- Fixed Newsfeed drop shadow when there is an update item ([PR 2242](https://github.com/input-output-hk/daedalus/pull/2242)) - ## 2.4.1 ### Fixes diff --git a/source/renderer/app/components/wallet/transactions/render-strategies/VirtualTransactionList.js b/source/renderer/app/components/wallet/transactions/render-strategies/VirtualTransactionList.js index a76b681172..57f9671f2b 100644 --- a/source/renderer/app/components/wallet/transactions/render-strategies/VirtualTransactionList.js +++ b/source/renderer/app/components/wallet/transactions/render-strategies/VirtualTransactionList.js @@ -56,11 +56,7 @@ export class VirtualTransactionList extends Component { } componentDidUpdate(prevProps: Props) { - // Recompute all row heights in case the number of rows has changed - const prevNumberOfRows = prevProps.rows.length; - const nextNumberOfRows = this.props.rows.length; - if (prevNumberOfRows && prevNumberOfRows !== nextNumberOfRows) { - this.rowHeights = this.estimateRowHeights(this.props.rows); + if (this.props.rows.length !== prevProps.rows.length) { this.recomputeVirtualRowHeights(); } } @@ -302,6 +298,11 @@ export class VirtualTransactionList extends Component { // Prevent List rendering if we have no rows to render if (!rows.length) return false; + // Recompute all row heights in case the number of rows has changed + if (this.rowHeights.length !== rows.length) { + this.rowHeights = this.estimateRowHeights(rows); + } + const componentStyles = classNames([ styles.component, isLoadingSpinnerShown ? styles.withLoadingSpinner : null,