Filter empty continents directly in GraphQL query
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
$: globeResolution = innerWidth > 1440 && window.devicePixelRatio > 1 ? '4k' : '2k'
|
||||
|
||||
const { continents, locations } = getContext('global')
|
||||
const randomContinent: any = getRandomItem(continents.filter((cont: any) => cont.countries))
|
||||
const randomContinent: any = getRandomItem(continents)
|
||||
const markers = locations.map(({ name, slug, country, coordinates: { coordinates }}): Marker => ({
|
||||
name,
|
||||
slug,
|
||||
|
||||
@@ -114,11 +114,10 @@
|
||||
locations { id slug }
|
||||
}
|
||||
|
||||
continents: continent {
|
||||
continents: continent (filter: { countries: { slug: { _neq: "_empty" }}}) {
|
||||
name
|
||||
slug
|
||||
rotation
|
||||
countries { id slug }
|
||||
}
|
||||
|
||||
settings {
|
||||
@@ -163,14 +162,10 @@
|
||||
|
||||
if (res) {
|
||||
const { data } = res
|
||||
const filteredContinents = data.continents.filter((cont: any) => cont.countries.length)
|
||||
|
||||
return {
|
||||
props: {
|
||||
data: {
|
||||
...data,
|
||||
continents: filteredContinents,
|
||||
},
|
||||
data,
|
||||
count: {
|
||||
photos: data.countPhotos[0].count.id,
|
||||
locations: data.countLocations[0].count.id,
|
||||
|
||||
Reference in New Issue
Block a user