Fix for pagination not updating when selecting a new page

This commit is contained in:
Marcus Eide
2020-09-09 11:47:41 +02:00
parent ce05e7e898
commit a14182878e
@@ -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(