Skip to content

Commit 717d9ba

Browse files
authored
Remove the async keyword from BaseLinearDisplayModel (#5036)
1 parent 84bf687 commit 717d9ba

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

plugins/alignments/src/LinearPileupDisplay/SharedLinearPileupDisplayMixin.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,9 +377,7 @@ export function SharedLinearPileupDisplayMixin(
377377
icon: MenuOpenIcon,
378378
onClick: () => {
379379
self.clearFeatureSelection()
380-
self.selectFeature(feat).catch((e: unknown) => {
381-
getSession(self).notifyError(`${e}`, e)
382-
})
380+
self.selectFeature(feat)
383381
},
384382
},
385383
{
@@ -436,7 +434,7 @@ export function SharedLinearPileupDisplayMixin(
436434
)) as { feature: SimpleFeatureSerialized | undefined }
437435

438436
if (isAlive(self) && feature) {
439-
await self.selectFeature(new SimpleFeature(feature))
437+
self.selectFeature(new SimpleFeature(feature))
440438
}
441439
}
442440
} catch (e) {

plugins/linear-genome-view/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -234,29 +234,38 @@ function stateModelFactory() {
234234
/**
235235
* #action
236236
*/
237-
async selectFeature(feature: Feature) {
237+
selectFeature(feature: Feature) {
238238
const session = getSession(self)
239239
if (isSessionModelWithWidgets(session)) {
240240
const { rpcManager } = session
241241
const sessionId = getRpcSessionId(self)
242242
const track = getContainingTrack(self)
243243
const view = getContainingView(self)
244244
const adapterConfig = getConf(track, 'adapter')
245-
const descriptions = await rpcManager.call(
246-
sessionId,
247-
'CoreGetMetadata',
248-
{
249-
adapterConfig,
250-
},
251-
)
252-
session.showWidget(
253-
session.addWidget('BaseFeatureWidget', 'baseFeature', {
254-
featureData: feature.toJSON(),
255-
view,
256-
track,
257-
descriptions,
258-
}),
259-
)
245+
246+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
247+
;(async () => {
248+
try {
249+
const descriptions = await rpcManager.call(
250+
sessionId,
251+
'CoreGetMetadata',
252+
{
253+
adapterConfig,
254+
},
255+
)
256+
session.showWidget(
257+
session.addWidget('BaseFeatureWidget', 'baseFeature', {
258+
featureData: feature.toJSON(),
259+
view,
260+
track,
261+
descriptions,
262+
}),
263+
)
264+
} catch (e) {
265+
console.error(e)
266+
getSession(e).notifyError(`${e}`, e)
267+
}
268+
})()
260269
}
261270

262271
if (isSelectionContainer(session)) {
@@ -335,11 +344,7 @@ function stateModelFactory() {
335344
icon: MenuOpenIcon,
336345
onClick: () => {
337346
if (self.contextMenuFeature) {
338-
self
339-
.selectFeature(self.contextMenuFeature)
340-
.catch((e: unknown) => {
341-
getSession(e).notifyError(`${e}`, e)
342-
})
347+
self.selectFeature(self.contextMenuFeature)
343348
}
344349
},
345350
},
@@ -373,9 +378,7 @@ function stateModelFactory() {
373378
} else {
374379
const feature = self.features.get(f)
375380
if (feature) {
376-
self.selectFeature(feature).catch((e: unknown) => {
377-
getSession(e).notifyError(`${e}`, e)
378-
})
381+
self.selectFeature(feature)
379382
}
380383
}
381384
},

0 commit comments

Comments
 (0)