From a14182878e565a63738a243464cb08c74ead4190 Mon Sep 17 00:00:00 2001 From: Marcus Eide Date: Wed, 9 Sep 2020 11:47:41 +0200 Subject: [PATCH] Fix for pagination not updating when selecting a new page --- .../lighthouse/src/components/AuditList/AuditListTable.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/lighthouse/src/components/AuditList/AuditListTable.tsx b/plugins/lighthouse/src/components/AuditList/AuditListTable.tsx index 92d61439a2..4b604c9a85 100644 --- a/plugins/lighthouse/src/components/AuditList/AuditListTable.tsx +++ b/plugins/lighthouse/src/components/AuditList/AuditListTable.tsx @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import React, { FC, useState } from 'react'; +import React, { FC, useState, useEffect } from 'react'; import { Table, TableColumn, TrendLine, useApi } from '@backstage/core'; import { Website, lighthouseApiRef } from '../../api'; import { useInterval } from 'react-use'; @@ -55,6 +55,10 @@ export const AuditListTable: FC<{ items: Website[] }> = ({ items }) => { const [websiteState, setWebsiteState] = useState(items); const lighthouseApi = useApi(lighthouseApiRef); + useEffect(() => { + setWebsiteState(items); + }, [items]); + const runRefresh = (websites: Website[]) => { websites.forEach(async website => { const response = await lighthouseApi.getWebsiteForAuditId(