Skip to content

Commit

Permalink
EPMRPP-96603 || Search component does not work on all pages (#4096)
Browse files Browse the repository at this point in the history
  • Loading branch information
BlazarQSO authored Nov 15, 2024
1 parent b5127d6 commit 43d75c5
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/src/controllers/instance/organizations/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const organizationsListPaginationSelector = (state) =>

export const querySelector = createAlternativeQueryParametersSelector({
defaultPagination: DEFAULT_PAGINATION,
defaultDirection: SORTING_ASC,
defaultSorting: SORTING_ASC,
sortingKey: SORTING_KEY,
namespace: NAMESPACE,
alternativeNamespace: NAMESPACE,
});
4 changes: 2 additions & 2 deletions app/src/controllers/organization/projects/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const loadingSelector = (state) => domainSelector(state).loading || false

export const querySelector = createAlternativeQueryParametersSelector({
defaultPagination: DEFAULT_PAGINATION,
defaultDirection: SORTING_ASC,
defaultSorting: SORTING_ASC,
sortingKey: SORTING_KEY,
namespace: NAMESPACE,
alternativeNamespace: NAMESPACE,
});
4 changes: 2 additions & 2 deletions app/src/controllers/organization/users/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const loadingSelector = (state) => domainSelector(state).loading || false

export const querySelector = createAlternativeQueryParametersSelector({
defaultPagination: DEFAULT_PAGINATION,
defaultDirection: SORTING_ASC,
defaultSorting: SORTING_ASC,
sortingKey: SORTING_KEY,
namespace: NAMESPACE,
alternativeNamespace: NAMESPACE,
});
11 changes: 7 additions & 4 deletions app/src/controllers/pages/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,16 @@ export const prevPagePropertiesSelector = (

export const createQueryParametersSelector = ({
namespace: staticNamespace,
alternativeNamespace,
defaultPagination,
defaultSorting,
sortingKey = SORTING_KEY,
} = {}) => (state, namespace) => {
const calculatedNamespace = staticNamespace || namespace;
const calculatedNamespace = staticNamespace || namespace || alternativeNamespace;
const calculatedPagination = defaultPagination || DEFAULT_PAGINATION;
const query = pagePropertiesSelector(state, calculatedNamespace);
const query = alternativeNamespace
? querySelector(state)
: pagePropertiesSelector(state, calculatedNamespace);
const queryParameters = {
...calculatedPagination,
[sortingKey]: defaultSorting || '',
Expand All @@ -138,14 +141,14 @@ export const createAlternativeQueryParametersSelector = ({
defaultPagination,
defaultSorting,
sortingKey,
namespace,
alternativeNamespace,
} = {}) =>
createSelector(
createQueryParametersSelector({
defaultPagination,
defaultSorting,
sortingKey,
namespace,
alternativeNamespace,
}),
({ [SIZE_KEY]: limit, [SORTING_KEY]: sort, [PAGE_KEY]: pageNumber, ...rest }) => {
return { ...getAlternativePaginationAndSortParams(sort, limit, pageNumber), ...rest };
Expand Down

0 comments on commit 43d75c5

Please sign in to comment.