Fixed scene filter breaking without page entity. Improved scroll restore after applying filter.
This commit is contained in:
parent
858a1f7087
commit
3cf8fd1bb8
|
@ -51,6 +51,7 @@
|
|||
</transition>
|
||||
|
||||
<div
|
||||
ref="scenesContainer"
|
||||
class="scenes-container"
|
||||
:class="{ loading }"
|
||||
>
|
||||
|
@ -154,12 +155,17 @@
|
|||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, inject } from 'vue';
|
||||
import {
|
||||
ref,
|
||||
computed,
|
||||
inject,
|
||||
} from 'vue';
|
||||
|
||||
import { parse } from 'path-to-regexp';
|
||||
|
||||
import navigate from '#/src/navigate.js';
|
||||
import { get } from '#/src/api.js';
|
||||
import events from '#/src/events.js';
|
||||
// import events from '#/src/events.js';
|
||||
import entityPrefixes from '#/src/entities-prefixes.js';
|
||||
import { getActorIdentifier, parseActorIdentifier } from '#/src/query.js';
|
||||
|
||||
|
@ -216,6 +222,7 @@ const currentPage = ref(Number(routeParams.page));
|
|||
const scope = ref(routeParams.scope || props.defaultScope);
|
||||
const total = ref(Number(pageProps.sceneTotal || pageProps.total));
|
||||
const loading = ref(false);
|
||||
const scenesContainer = ref(null);
|
||||
|
||||
const actorIds = urlParsed.search.actors?.split(',').map((identifier) => parseActorIdentifier(identifier)?.id).filter(Boolean) || [];
|
||||
const queryActors = actorIds.map((urlActorId) => aggActors.value.find((aggActor) => aggActor.id === urlActorId)).filter(Boolean);
|
||||
|
@ -279,7 +286,7 @@ async function search(options = {}) {
|
|||
|
||||
const entity = filters.value.entity || pageEntity;
|
||||
// const entitySlug = entity?.type === 'network' ? `_${entity.slug}` : entity?.slug;
|
||||
const entitySlug = `${entityPrefixes[entity.type]}${entity.slug}`;
|
||||
const entitySlug = entity && `${entityPrefixes[entity.type]}${entity.slug}`;
|
||||
|
||||
loading.value = true;
|
||||
|
||||
|
@ -312,7 +319,8 @@ async function search(options = {}) {
|
|||
total.value = res.total;
|
||||
loading.value = false;
|
||||
|
||||
events.emit('scrollUp');
|
||||
// events.emit('scrollUp');
|
||||
scenesContainer.value?.scrollIntoView(true);
|
||||
}
|
||||
|
||||
function updateFilter(prop, value, reload = true) {
|
||||
|
@ -353,6 +361,7 @@ function updateFilter(prop, value, reload = true) {
|
|||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-grow: 1;
|
||||
scroll-margin-top: 3rem; /* ensure scroll into view includes meta bar */
|
||||
}
|
||||
|
||||
.meta {
|
||||
|
|
|
@ -570,8 +570,6 @@ export async function fetchScenes(filters, rawOptions, reqUser) {
|
|||
const tagCounts = options.aggregateTags && countAggregations(result.aggregations?.tagIds);
|
||||
const channelCounts = options.aggregateChannels && countAggregations(entityIds);
|
||||
|
||||
console.log('entity ids', entityIds);
|
||||
|
||||
console.time('fetch aggregations');
|
||||
|
||||
const [aggActors, aggTags, aggChannels] = await Promise.all([
|
||||
|
|
Loading…
Reference in New Issue