Skip to content

Commit

Permalink
Merge pull request #668 from globe-and-citizen/667-bug-load-more-butt…
Browse files Browse the repository at this point in the history
…on-visible

fix:#667 - Fixed load more button visible
  • Loading branch information
marclupanc authored Dec 12, 2024
2 parents 742a65b + a2615e1 commit a0347cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/pages/SearchPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@
</TransitionGroup>
<div v-if="showHasMore" class="row justify-center q-mt-md">
<q-spinner v-if="promptStore.isLoading && promptStore.getPrompts?.length" color="primary" size="70px" :thickness="5" />
<q-btn v-else @click="loadMorePrompts" label="Load More" data-test="load-more-btn" color="primary" />
<q-btn
v-else-if="promptStore.getPrompts?.length"
@click="loadMorePrompts"
label="Load More"
data-test="load-more-btn"
color="primary"
/>
</div>
</q-page>
</q-page-container>
Expand Down
5 changes: 2 additions & 3 deletions src/stores/prompts.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ export const usePromptStore = defineStore('prompts', {

if (newPrompts.length > 0) {
this._lastVisible = querySnapshot.docs[querySnapshot.docs.length - 1]
this._hasMore = true
} else {
this._hasMore = false
}
if (newPrompts.length > 4) this._hasMore = true
else this._hasMore = false

this._prompts = loadMore ? [...(this._prompts || []), ...newPrompts] : newPrompts

Expand Down

0 comments on commit a0347cb

Please sign in to comment.