Unverified Commit 65cbbd6c authored by David López's avatar David López Committed by GitHub
Browse files

Merge pull request #14196 from mvdbeek/backport_history_list_scroll_position

[22.05] Backport history list scroll position fix
parents 56429d43 e7a8adca
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -91,8 +91,13 @@
                                    No data found for selected filter.
                                </b-alert>
                            </div>
                            <Listing v-else :items="itemsLoaded" :query-key="queryKey" @scroll="onScroll">
                                <template v-slot:item="{ item }">
                            <Listing
                                v-else
                                :offset="listOffset"
                                :items="itemsLoaded"
                                :query-key="queryKey"
                                @scroll="onScroll">
                                <template v-slot:item="{ item, currentOffset }">
                                    <ContentItem
                                        v-if="!invisible[item.hid]"
                                        :id="item.hid"
@@ -109,7 +114,7 @@
                                        @toggleHighlights="toggleHighlights"
                                        @update:expand-dataset="setExpanded(item, $event)"
                                        @update:selected="setSelected(item, $event)"
                                        @view-collection="$emit('view-collection', item)"
                                        @view-collection="$emit('view-collection', item, currentOffset)"
                                        @delete="onDelete(item)"
                                        @undelete="onUndelete(item)"
                                        @unhide="onUnhide(item)" />
@@ -165,6 +170,7 @@ export default {
        OperationErrorDialog,
    },
    props: {
        listOffset: { type: Number, default: 0 },
        history: { type: Object, required: true },
    },
    data() {
+4 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
            <div v-if="currentHistory" id="current-history-panel" class="history-index">
                <CurrentHistory
                    v-if="!breadcrumbs.length"
                    :list-offset="listOffset"
                    :history="currentHistory"
                    v-on="handlers"
                    @view-collection="onViewCollection">
@@ -51,10 +52,12 @@ export default {
        return {
            // list of collections we have drilled down into
            breadcrumbs: [],
            listOffset: 0,
        };
    },
    methods: {
        onViewCollection(collection) {
        onViewCollection(collection, currentOffset) {
            this.listOffset = currentOffset;
            this.breadcrumbs = [...this.breadcrumbs, collection];
        },
    },
+6 −1
Original line number Diff line number Diff line
@@ -4,11 +4,12 @@
            ref="listing"
            class="listing"
            data-key="id"
            :offset="offset"
            :data-sources="items"
            :data-component="{}"
            @scroll="onScroll">
            <template v-slot:item="{ item }">
                <slot name="item" :item="item" />
                <slot name="item" :item="item" :current-offset="getOffset()" />
            </template>
            <template v-slot:footer>
                <LoadingSpan v-if="loading" class="m-2" message="Loading" />
@@ -27,6 +28,7 @@ export default {
        VirtualList,
    },
    props: {
        offset: { type: Number, default: 0 },
        loading: { type: Boolean, default: false },
        items: { type: Array, default: null },
        queryKey: { type: String, default: null },
@@ -74,6 +76,9 @@ export default {
            const rangeStart = this.$refs.listing.range.start;
            this.$emit("scroll", rangeStart);
        },
        getOffset() {
            return this.$refs.listing?.getOffset() || 0;
        },
    },
};
</script>