Skip to content

Commit

Permalink
kodadot#2351 Bug fix with search in gallery not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
prachi00 committed Feb 16, 2022
1 parent 27b91ec commit 2f0c9ab
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions components/rmrk/Gallery/Gallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

<div>
<div class="columns is-multiline">
<div class="column is-4 column-padding" v-for="nft in results" :key="nft.id">
<div
class="column is-4 column-padding"
v-for="nft in results"
:key="nft.id">
<div class="card nft-card">
<nuxt-link
:to="`/${urlPrefix}/gallery/${nft.id}`"
Expand Down Expand Up @@ -81,7 +84,7 @@
</template>

<script lang="ts">
import { Component, mixins, Vue } from 'nuxt-property-decorator'
import { Component, mixins, Vue, Watch } from 'nuxt-property-decorator'
import { NftEntity as GraphNFT } from '@/components/rmrk/service/types'
import {
getCloudflareImageLinks,
Expand All @@ -102,6 +105,7 @@ import PrefixMixin from '~/utils/mixins/prefixMixin'
import { NFTMetadata } from '../service/scheme'
import { getSanitizer } from '../utils'
import { SearchQuery } from './Search/types'
import shouldUpdate from '~/utils/shouldUpdate'
type GraphResponse = NFTEntitiesWithCount<GraphNFT>
Expand Down Expand Up @@ -270,6 +274,13 @@ export default class Gallery extends mixins(PrefixMixin) {
return params
}
@Watch('$route.query.search')
protected onIdChange(val: string, oldVal: string) {
if (shouldUpdate(val, oldVal)) {
this.searchQuery.search = this.$route.query?.search?.toString() || ''
}
}
get results() {
// if (this.searchQuery) {
// return basicAggQuery(expandedFilter(this.searchQuery, this.nfts))
Expand Down

0 comments on commit 2f0c9ab

Please sign in to comment.