From dc7325b7de12bf213e51e688dc55dc912d3770d9 Mon Sep 17 00:00:00 2001 From: "Collin M. Barrett" Date: Mon, 5 Aug 2019 14:58:22 -0500 Subject: [PATCH] rm need for separate loading boolean in state --- src/FilterLists.Web.V2/package-lock.json | Bin 542413 -> 542414 bytes src/FilterLists.Web.V2/package.json | 2 +- .../modules/allListsTable/AllListsTable.tsx | 43 ++++++++---------- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/FilterLists.Web.V2/package-lock.json b/src/FilterLists.Web.V2/package-lock.json index 15449eb4e06ba87ef51fee84dcafd92157f57ed1..c6c1284cc9249255342a3c76d7c9c5956fbdb3c0 100644 GIT binary patch delta 27 icmX@xt9Y(gv7v>rg{g(Pg{6hHg{_5s3&&YEMlJx5#0d%j delta 25 gcmX@tt9Z6ov7v>rg{g(Pg{6hHg{_5s3&&YE0Dip){{R30 diff --git a/src/FilterLists.Web.V2/package.json b/src/FilterLists.Web.V2/package.json index 8c6e4ee0b..9554ac1bc 100644 --- a/src/FilterLists.Web.V2/package.json +++ b/src/FilterLists.Web.V2/package.json @@ -38,4 +38,4 @@ "last 1 safari version" ] } -} \ No newline at end of file +} diff --git a/src/FilterLists.Web.V2/src/modules/allListsTable/AllListsTable.tsx b/src/FilterLists.Web.V2/src/modules/allListsTable/AllListsTable.tsx index 2f36701e0..cb14efdbe 100644 --- a/src/FilterLists.Web.V2/src/modules/allListsTable/AllListsTable.tsx +++ b/src/FilterLists.Web.V2/src/modules/allListsTable/AllListsTable.tsx @@ -4,32 +4,29 @@ import { nameof } from '../../utils'; import { List } from './List'; interface State { - data: List[]; - loading: boolean; + data: List[]; } export class AllListsTable extends React.Component<{}, State> { - constructor(props: any) { - super(props); - this.state = { - data: [], - loading: false, - }; - } + constructor(props: any) { + super(props); + this.state = { + data: [] + }; + } - componentDidMount() { - this.setState({ loading: true }); - fetch("/api/v1/lists") - .then(response => response.json()) - .then(json => { this.setState({ data: json, loading: false }); }) - } + componentDidMount() { + fetch("/api/v1/lists") + .then(response => response.json()) + .then(json => { this.setState({ data: json }); }) + } - render() { - return ( - dataSource={this.state.data} rowKey={record => record.id.toString()} loading={this.state.loading} size="small" pagination={{ position: "top", size: "small" }} > - title="Name" dataIndex={nameof("name")} width={250} fixed="left" /> - title="Description" dataIndex={nameof("description")} /> - - ); - } + render() { + return ( + dataSource={this.state.data} rowKey={record => record.id.toString()} loading={this.state.data.length > 0 ? false : true} size="small" pagination={{ position: "top", size: "small" }} > + title="Name" dataIndex={nameof("name")} width={250} fixed="left" /> + title="Description" dataIndex={nameof("description")} /> + + ); + } } \ No newline at end of file