From e5c366f7d7a154b0f35292956f26d25b711a0cc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20D=C4=99bi=C5=84ski?= Date: Tue, 14 Jan 2025 10:30:45 +0100 Subject: [PATCH] IBX-9333: introduced isPriorityUpdate to reload sub-items page after priority update --- .../ui-dev/src/modules/sub-items/sub.items.module.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/bundle/ui-dev/src/modules/sub-items/sub.items.module.js b/src/bundle/ui-dev/src/modules/sub-items/sub.items.module.js index 35cb305043..e00e9c4a90 100644 --- a/src/bundle/ui-dev/src/modules/sub-items/sub.items.module.js +++ b/src/bundle/ui-dev/src/modules/sub-items/sub.items.module.js @@ -134,6 +134,7 @@ export default class SubItemsModule extends Component { morePanelVisible: false, morePanelVisibleItemsIndexes: [], queryParams: {}, + isPriorityUpdate: false, }; } @@ -171,7 +172,7 @@ export default class SubItemsModule extends Component { } componentDidUpdate() { - const { activePageIndex, activePageItems, totalCount } = this.state; + const { activePageIndex, activePageItems, totalCount, isPriorityUpdate } = this.state; const { limit: itemsPerPage } = this.props; const pagesCount = Math.ceil(totalCount / itemsPerPage); const pageDoesNotExist = activePageIndex > pagesCount - 1 && activePageIndex !== 0; @@ -186,7 +187,7 @@ export default class SubItemsModule extends Component { const shouldLoadPage = !activePageItems; - if (shouldLoadPage && this.requestParamsHaveChanged(activePageIndex)) { + if (shouldLoadPage && (this.requestParamsHaveChanged(activePageIndex) || isPriorityUpdate)) { this.loadPage(activePageIndex); } @@ -261,6 +262,7 @@ export default class SubItemsModule extends Component { sortOrder, cursor, }, + isPriorityUpdate: false, }); loadLocation(restInfo, queryConfig, (response) => { @@ -330,6 +332,10 @@ export default class SubItemsModule extends Component { * @memberof SubItemsModule */ afterPriorityUpdated(response) { + this.setState({ + isPriorityUpdate: true, + }); + if (this.state.sortClause === 'LocationPriority') { this.discardActivePageItems(); this.refreshContentTree();