Skip to content

Commit

Permalink
EZP-31261: UDW tree is not loaded properly when switching from Bookma…
Browse files Browse the repository at this point in the history
…rks tab
  • Loading branch information
dew326 committed Jan 20, 2020
1 parent 4fa32e5 commit 7ec5b9a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const FinderBranch = ({ locationData }) => {
let resizeStartPositionX = 0;
let branchCurrentWidth = 0;
const loadMore = ({ target }) => {
const areAllItemsLoaded = loadedLocations.location && locationData.subitems.length >= loadedLocations.location.childCount;
const areAllItemsLoaded = locationData.subitems.length >= loadedLocations.totalCount;
const isOffsetReached = target.scrollHeight - target.clientHeight - target.scrollTop < SCROLL_OFFSET;

if (areAllItemsLoaded || !isOffsetReached || isLoading) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const GridView = () => {
true
);
const loadMore = ({ target }) => {
const areAllItemsLoaded = loadedLocations.location && locationData.subitems.length >= loadedLocations.location.childCount;
const areAllItemsLoaded = locationData.subitems.length >= loadedLocations.totalCount;
const isOffsetReached = target.scrollHeight - target.clientHeight - target.scrollTop < SCROLL_OFFSET;

if (areAllItemsLoaded || !isOffsetReached || isLoading) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const ContentCreataTabModule = () => {
const parentLocationData = clonedLoadedLocations[clonedLoadedLocations.length - 1];

parentLocationData.subitems = [];
parentLocationData.location.childCount = parentLocationData.location.childCount + 1;
parentLocationData.totalCount = parentLocationData.totalCount + 1;

dispatchLoadedLocationsAction({ type: 'SET_LOCATIONS', data: clonedLoadedLocations });
dispatchSelectedLocationsAction({ type: 'ADD_SELECTED_LOCATION', location: items[0] });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ export const useFindLocationsByParentLocationIdFetch = (locationData, { sortClau
if (
!locationData.parentLocationId ||
locationData.collapsed ||
((locationData.location && locationData.subitems.length >= locationData.location.childCount) ||
locationData.subitems.length >= limit + offset)
(locationData.subitems.length >= locationData.totalCount || locationData.subitems.length >= limit + offset)
) {
dispatch({ type: 'FETCH_END', data: {} });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ export const findLocationsByParentLocationId = (

return mappedSubitems;
});

callback({
location: location.Location,
version: version.Version,
const locationData = {
location: location ? location.Location : null,
version: version ? version.Version : null,
totalCount: subitems.totalCount || 4,
subitems: subitemsData,
bookmarked: bookmark,
permissions,
parentLocationId,
});
};

callback(locationData);
})
.catch(showErrorNotification);
};
Expand Down

0 comments on commit 7ec5b9a

Please sign in to comment.