Skip to content

Commit

Permalink
Improve current list offset calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
itisAliRH committed Jun 21, 2022
1 parent 45245af commit fbff9b8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions client/src/components/History/CurrentHistory/HistoryPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
:items="itemsLoaded"
:query-key="queryKey"
@scroll="onScroll">
<template v-slot:item="{ item, getOffset }">
<template v-slot:item="{ item, currentOffset }">
<ContentItem
v-if="!invisible[item.hid]"
:id="item.hid"
Expand All @@ -114,7 +114,7 @@
@toggleHighlights="toggleHighlights"
@update:expand-dataset="setExpanded(item, $event)"
@update:selected="setSelected(item, $event)"
@view-collection="$emit('view-collection', item, getOffset)"
@view-collection="$emit('view-collection', item, currentOffset)"
@delete="onDelete(item)"
@undelete="onUndelete(item)"
@unhide="onUnhide(item)" />
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/History/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export default {
};
},
methods: {
onViewCollection(collection, getListOffset) {
this.listOffset = getListOffset();
onViewCollection(collection, currentOffset) {
this.listOffset = currentOffset;
this.breadcrumbs = [...this.breadcrumbs, collection];
},
},
Expand Down
4 changes: 2 additions & 2 deletions client/src/components/History/Layout/Listing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:data-component="{}"
@scroll="onScroll">
<template v-slot:item="{ item }">
<slot name="item" :item="item" :get-offset="getOffset" />
<slot name="item" :item="item" :current-offset="getOffset()" />
</template>
<template v-slot:footer>
<LoadingSpan v-if="loading" class="m-2" message="Loading" />
Expand Down Expand Up @@ -77,7 +77,7 @@ export default {
this.$emit("scroll", rangeStart);
},
getOffset() {
return this.$refs.listing.getOffset();
return this.$refs.listing?.getOffset() || 0;
},
},
};
Expand Down

0 comments on commit fbff9b8

Please sign in to comment.