Skip to content

Commit

Permalink
prevent flashing
Browse files Browse the repository at this point in the history
  • Loading branch information
arily committed Jul 4, 2023
1 parent 11e16c1 commit fa3dae0
Showing 1 changed file with 5 additions and 21 deletions.
26 changes: 5 additions & 21 deletions src/pages/leaderboard/[[mode]].vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,23 @@ const mode = (
? pMode
: availableModes[0]
) as ActiveMode
const ruleset = (
(isString(pRuleset) && availableRulesets.includes(pRuleset))
? pRuleset
: availableRulesets[0]
) as ActiveRuleset
const rankingSystem = (
(isString(pRankingSystem) && availableRankingSystems.includes(pRankingSystem))
? pRankingSystem
: availableRankingSystems[0]
) as LeaderboardRankingSystem
const page = shallowRef((isString(pPage) && Number.parseInt(pPage)) || 1)
const perPage = 20
if (!pMode || !pRuleset || !pRankingSystem) {
// rewrite url to show stat of the page
await navigateTo({
name: 'leaderboard-mode',
params: {
mode,
},
query: {
ruleset,
ranking: rankingSystem,
},
})
}
const total = await app$.$client.leaderboard.overallRange.query()
const outOfRange = page.value * perPage - perPage > total
Expand Down Expand Up @@ -101,7 +90,6 @@ function reloadPage(i?: number) {
if (i) {
page.value = i
}
table.value && (table.value.length = 0)
rewriteHistory()
refresh()
}
Expand Down Expand Up @@ -137,7 +125,7 @@ function reloadPage(i?: number) {
>
<!-- <fetch-overlay :fetching="pending" /> -->

<div v-if="table.length" class="relative mx-auto xl:rounded-lg w-full max-w-max overflow-x-auto">
<div v-if="table.length" class="relative mx-auto xl:rounded-lg w-full max-w-max">
<table
class="table mx-2 table-compact border-separate whitespace-nowrap"
>
Expand All @@ -160,18 +148,14 @@ function reloadPage(i?: number) {
</tr>
</thead>
<transition name="slide">
<tbody v-if="!pending">
<tbody>
<leaderboard-user-table
v-for="(item, index) in table"
:key="index"
:user="item.user"
:in-this-leaderboard="item.inThisLeaderboard"
:sort="selected.rankingSystem"
/>

<!-- <template v-else>
Loading...
</template> -->
</tbody>
</transition>
</table>
Expand Down

0 comments on commit fa3dae0

Please sign in to comment.