Skip to content

Commit 3294c58

Browse files
committed
Chore: remove unneccessary query logic
1 parent 546bfc9 commit 3294c58

File tree

2 files changed

+17
-27
lines changed

2 files changed

+17
-27
lines changed

src/components/DataViz/BarChart.jsx

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -117,28 +117,23 @@ export const BarChartMachine = Machine(
117117
},
118118
},
119119
services: {
120-
fetchGeneLength: async (
121-
_ctx,
122-
{ type, globalConfig: { classView, rootUrl }, query: nextQuery }
123-
) => {
124-
let query = nextQuery
125-
let path = 'length'
126-
127-
if (type === FETCH_INITIAL_SUMMARY) {
128-
query = {
129-
from: classView,
130-
select: ['length', 'primaryIdentifier'],
131-
orderBy: [
132-
{
133-
path: 'length',
134-
direction: 'ASC',
135-
},
136-
],
137-
}
120+
fetchGeneLength: async (_ctx, { globalConfig: { classView, rootUrl }, query: nextQuery }) => {
121+
let query = {
122+
...nextQuery,
123+
from: classView,
124+
select: ['length', 'primaryIdentifier'],
125+
model: {
126+
name: 'genomic',
127+
},
128+
orderBy: [
129+
{
130+
path: 'length',
131+
direction: 'ASC',
132+
},
133+
],
138134
}
139135

140-
query.model = { name: 'genomic' }
141-
const summary = await fetchSummary({ rootUrl, query, path })
136+
const summary = await fetchSummary({ rootUrl, query, path: 'length' })
142137

143138
return {
144139
classView,

src/components/DataViz/PieChart.jsx

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,25 +113,20 @@ export const PieChartMachine = Machine(
113113
services: {
114114
fetchItems: async (_ctx, event) => {
115115
const {
116-
type,
117116
globalConfig: { classView, rootUrl },
118117
query: nextQuery,
119118
} = event
120119

121-
const path = 'organism.shortName'
122120
let query = {
123121
...nextQuery,
124122
from: classView,
123+
select: ['primaryIdentifier'],
125124
model: {
126125
name: 'genomic',
127126
},
128127
}
129128

130-
if (type === FETCH_INITIAL_SUMMARY) {
131-
query.select = ['primaryIdentifier']
132-
}
133-
134-
const summary = await fetchSummary({ rootUrl: `${rootUrl}/service`, query, path })
129+
const summary = await fetchSummary({ rootUrl, query, path: 'organism.shortName' })
135130

136131
return {
137132
classView,

0 commit comments

Comments
 (0)