Skip to content
Snippets Groups Projects
Commit d0ecc36b authored by Domonkos Gulyas's avatar Domonkos Gulyas
Browse files

Merge branch 'fix-record-table-in-IOC-details' into 'develop'

Fix infinite record table loading in IOC details

See merge request !392
parents 56312c56 30286bb7
No related branches found
No related tags found
2 merge requests!407CE-2141: 3.0.0,!392Fix infinite record table loading in IOC details
Pipeline #163238 failed
...@@ -83,7 +83,7 @@ export function RecordSearch({ iocName, rowType }) { ...@@ -83,7 +83,7 @@ export function RecordSearch({ iocName, rowType }) {
const rowsPerPage = [20, 50]; const rowsPerPage = [20, 50];
const { pagination, setPagination } = usePagination({ const { pagination, setPagination, setTotalCount } = usePagination({
rowsPerPageOptions: rowsPerPage, rowsPerPageOptions: rowsPerPage,
initLimit: urlPagination.rows ?? rowsPerPage[0], initLimit: urlPagination.rows ?? rowsPerPage[0],
initPage: urlPagination.page ?? 0 initPage: urlPagination.page ?? 0
...@@ -91,8 +91,14 @@ export function RecordSearch({ iocName, rowType }) { ...@@ -91,8 +91,14 @@ export function RecordSearch({ iocName, rowType }) {
// update pagination whenever search result total pages change // update pagination whenever search result total pages change
useEffect(() => { useEffect(() => {
setPagination({ totalCount: records?.totalCount ?? 0 }); setTotalCount((prev) => {
}, [setPagination, records?.totalCount]); if (prev === pagination.totalCount && prev > 0) {
return prev;
} else {
return records?.totalCount ?? 0;
}
});
}, [pagination, records?.totalCount, setTotalCount]);
// whenever url state changes, update pagination // whenever url state changes, update pagination
useEffect(() => { useEffect(() => {
...@@ -110,6 +116,7 @@ export function RecordSearch({ iocName, rowType }) { ...@@ -110,6 +116,7 @@ export function RecordSearch({ iocName, rowType }) {
let requestParams = initRequestParams(pagination); let requestParams = initRequestParams(pagination);
requestParams.pv_status = recordFilter; requestParams.pv_status = recordFilter;
requestParams.record_name = deserialize(urlState.query); requestParams.record_name = deserialize(urlState.query);
requestParams.ioc_name = iocName;
getRecords(requestParams); getRecords(requestParams);
return () => { return () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment