Skip to content

Commit

Permalink
IBX-9333: introduced isPriorityUpdate to reload sub-items page after …
Browse files Browse the repository at this point in the history
…priority update
  • Loading branch information
Mateusz Dębiński committed Jan 14, 2025
1 parent d6d83c7 commit 1f483a9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/bundle/ui-dev/src/modules/sub-items/sub.items.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export default class SubItemsModule extends Component {
morePanelVisible: false,
morePanelVisibleItemsIndexes: [],
queryParams: {},
isPriorityUpdate: false,
};
}

Expand Down Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down Expand Up @@ -261,6 +262,7 @@ export default class SubItemsModule extends Component {
sortOrder,
cursor,
},
isPriorityUpdate: false
});

loadLocation(restInfo, queryConfig, (response) => {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 1f483a9

Please sign in to comment.