message-table-pagination-fix (#1343)

* respect message list pagination options on the message instance list table w/ burnettk

* code rabbit suggestion w/ burnettk

---------

Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
jasquat 2024-04-05 18:49:45 +00:00 committed by GitHub
parent dc3e009446
commit 18edf627db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 3 deletions

View File

@ -19,6 +19,8 @@ type OwnProps = {
processInstanceId?: number;
};
const paginationQueryParamPrefix = 'message-list';
export default function MessageInstanceList({ processInstanceId }: OwnProps) {
const [messageIntances, setMessageInstances] = useState([]);
const [pagination, setPagination] = useState(null);
@ -32,7 +34,12 @@ export default function MessageInstanceList({ processInstanceId }: OwnProps) {
setMessageInstances(result.results);
setPagination(result.pagination);
};
const { page, perPage } = getPageInfoFromSearchParams(searchParams);
const { page, perPage } = getPageInfoFromSearchParams(
searchParams,
undefined,
undefined,
paginationQueryParamPrefix
);
let queryParamString = `per_page=${perPage}&page=${page}`;
if (processInstanceId) {
queryParamString += `&process_instance_id=${processInstanceId}`;
@ -155,7 +162,12 @@ export default function MessageInstanceList({ processInstanceId }: OwnProps) {
};
if (pagination) {
const { page, perPage } = getPageInfoFromSearchParams(searchParams);
const { page, perPage } = getPageInfoFromSearchParams(
searchParams,
undefined,
undefined,
paginationQueryParamPrefix
);
let breadcrumbElement = null;
if (searchParams.get('process_instance_id')) {
breadcrumbElement = (
@ -187,7 +199,7 @@ export default function MessageInstanceList({ processInstanceId }: OwnProps) {
perPage={perPage}
pagination={pagination}
tableToDisplay={buildTable()}
paginationQueryParamPrefix="message-list"
paginationQueryParamPrefix={paginationQueryParamPrefix}
/>
</>
);