Skip to content

Commit

Permalink
message-table-pagination-fix (sartography#1343)
Browse files Browse the repository at this point in the history
* respect message list pagination options on the message instance list table w/ burnettk

* code rabbit suggestion w/ burnettk

---------

Co-authored-by: jasquat <[email protected]>
  • Loading branch information
jasquat and jasquat authored Apr 5, 2024
1 parent dc3e009 commit 18edf62
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions spiffworkflow-frontend/src/components/MessageInstanceList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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}`;
Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -187,7 +199,7 @@ export default function MessageInstanceList({ processInstanceId }: OwnProps) {
perPage={perPage}
pagination={pagination}
tableToDisplay={buildTable()}
paginationQueryParamPrefix="message-list"
paginationQueryParamPrefix={paginationQueryParamPrefix}
/>
</>
);
Expand Down

0 comments on commit 18edf62

Please sign in to comment.