Fixed pagination not updating with async requests.

This commit is contained in:
DebaucheryLibrarian 2024-03-19 01:40:56 +01:00
parent 0bd4990b37
commit ab13ace280
6 changed files with 60 additions and 49 deletions

View File

@ -73,4 +73,15 @@ const emit = defineEmits(['country']);
text-overflow: ellipsis; text-overflow: ellipsis;
padding: .25rem .5rem; padding: .25rem .5rem;
} }
.filter-remove {
display: flex;
align-items: center;
padding: .5rem;
fill: var(--shadow);
&:hover {
fill: var(--error);
}
}
</style> </style>

View File

@ -169,8 +169,12 @@ function go(page, event) {
} }
function getPath(page) { function getPath(page) {
if (!routeParams.path && props.includeQuery) { const query = typeof window === 'undefined'
return `${pageContext.urlParsed.pathname}${page}${urlParsed.searchOriginal}`; ? urlParsed.searchOriginal
: window.location.search;
if (!routeParams.path && props.includeQuery && query) {
return `${pageContext.urlParsed.pathname}${page}${query}`;
} }
if (!routeParams.path) { if (!routeParams.path) {
@ -187,8 +191,8 @@ function getPath(page) {
}) })
.join(''); .join('');
if (props.includeQuery && urlParsed.searchOriginal) { if (props.includeQuery && query) {
return `${path}${urlParsed.searchOriginal}`; return `${path}${query}`;
} }
return path; return path;

View File

@ -2,6 +2,7 @@
<div <div
class="scenes-page" class="scenes-page"
> >
<transition name="sidebar">
<Filters <Filters
v-if="showFilters" v-if="showFilters"
:class="{ loading }" :class="{ loading }"
@ -34,6 +35,7 @@
@update="updateFilter" @update="updateFilter"
/> />
</Filters> </Filters>
</transition>
<div <div
class="scenes-container" class="scenes-container"
@ -104,7 +106,10 @@
</li> </li>
</ul> </ul>
<Pagination /> <Pagination
:total="total"
:page="currentPage"
/>
</div> </div>
<Ellipsis <Ellipsis

View File

@ -145,7 +145,10 @@
</li> </li>
</ul> </ul>
<Pagination /> <Pagination
:total="total"
:page="currentPage"
/>
</div> </div>
</div> </div>
</template> </template>
@ -354,6 +357,7 @@ function updateFilter(prop, value, reload = true) {
.tile-info { .tile-info {
flex-shrink: 0; flex-shrink: 0;
font-size: 0; font-size: 0;
overflow: hidden;
} }
.tile-meta { .tile-meta {

View File

@ -498,7 +498,7 @@ async function queryManticoreSql(filters, options, _reqUser) {
?.data.map((row) => ({ key: row.channel_id || row['scenes.channel_id'], doc_count: row['count(*)'] })) ?.data.map((row) => ({ key: row.channel_id || row['scenes.channel_id'], doc_count: row['count(*)'] }))
|| []; || [];
const total = results.at(-1).data.find((entry) => entry.Variable_name === 'total_found').Value; const total = Number(results.at(-1).data.find((entry) => entry.Variable_name === 'total_found').Value);
return { return {
scenes: results[0].data, scenes: results[0].data,

View File

@ -1,16 +1,3 @@
// This file isn't processed by Vite, see https://github.com/vikejs/vike/issues/562
// Consequently:
// - When changing this file, you needed to manually restart your server for your changes to take effect.
// - To use your environment variables defined in your .env files, you need to install dotenv, see https://vike.dev/env
// - To use your path aliases defined in your vite.config.js, you need to tell Node.js about them, see https://vike.dev/path-aliases
// If you want Vite to process your server code then use one of these:
// - vavite (https://github.com/cyco130/vavite)
// - See vavite + Vike examples at https://github.com/cyco130/vavite/tree/main/examples
// - vite-node (https://github.com/antfu/vite-node)
// - HatTip (https://github.com/hattipjs/hattip)
// - You can use Bati (https://batijs.github.io/) to scaffold a Vike + HatTip app. Note that Bati generates apps that use the V1 design (https://vike.dev/migration/v1-design) and Vike packages (https://vike.dev/vike-packages)
import config from 'config'; import config from 'config';
import express from 'express'; import express from 'express';
import boolParser from 'express-query-boolean'; import boolParser from 'express-query-boolean';