From d2c50e4221101a712474cb8ba808aa97b369a8b6 Mon Sep 17 00:00:00 2001 From: Nikki Moore Date: Thu, 29 Sep 2022 14:27:18 -0600 Subject: [PATCH] fix: column header filter tag disappearing when switching to chart and back --- src/components/ChataTable/ChataTable.js | 7 ++++--- src/components/QueryOutput/QueryOutput.js | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/ChataTable/ChataTable.js b/src/components/ChataTable/ChataTable.js index 0f2a46222..9a5efb8ea 100644 --- a/src/components/ChataTable/ChataTable.js +++ b/src/components/ChataTable/ChataTable.js @@ -187,8 +187,9 @@ export default class ChataTable extends React.Component { ajaxRequestFunc = async (props, params) => { try { + const prevTableParams = getTableParams(this.previousTableParams, this.ref) const tableParams = getTableParams(params, this.ref) - if (_isEqual(this.previousTableParams, tableParams)) { + if (_isEqual(prevTableParams, tableParams)) { return Promise.resolve() } @@ -197,7 +198,7 @@ export default class ChataTable extends React.Component { return Promise.resolve({ rows: this.props.data, page: 1 }) } - this.previousTableParams = tableParams + this.previousTableParams = params if (!props.queryRequestData) { console.warn( @@ -219,7 +220,7 @@ export default class ChataTable extends React.Component { const responseWrapper = await this.sortOrFilterData(props, tableParams) this.queryID = responseWrapper?.data?.data?.query_id response = { ..._get(responseWrapper, 'data.data', {}), page: 1 } - this.props.onNewData(responseWrapper, tableParams) + this.props.onNewData(responseWrapper, params) } this.setState({ scrollLoading: false, pageLoading: false }) diff --git a/src/components/QueryOutput/QueryOutput.js b/src/components/QueryOutput/QueryOutput.js index 6bf585163..f136aef6b 100644 --- a/src/components/QueryOutput/QueryOutput.js +++ b/src/components/QueryOutput/QueryOutput.js @@ -859,6 +859,7 @@ export class QueryOutput extends React.Component { this.setState({ tableParams: params }) setTimeout(() => { this.props.onRowChange() + this.updateToolbars() }, 0) }