Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Nov 23, 2024
1 parent 916bc11 commit 7db2a1c
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 23 deletions.
10 changes: 4 additions & 6 deletions plugins/circular-view/src/BaseChordDisplay/models/model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,14 @@ export const BaseChordDisplayModel = types

makeAbortableReaction(
self,
() =>
({
() => {
return {
assemblyNames: getTrackAssemblyNames(self.parentTrack),
adapter: getConf(getParent<any>(self, 2), 'adapter'),
assemblyManager: getSession(self).assemblyManager,
}) as const,
} as const
},
async (args, stopToken) => {
if (!args) {
return
}
return args
? args.assemblyManager.getRefNameMapForAdapter(
args.adapter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export async function renderReactionEffect(props?: any, stopToken?: string) {
...renderProps,
stopToken,
exportSVG,
stopToken,
})

return {
Expand Down
6 changes: 3 additions & 3 deletions plugins/gccontent/src/GCContentAdapter/GCContentAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ export default class GCContentAdapter extends BaseFeatureDataAdapter {
return adapter.dataAdapter as BaseFeatureDataAdapter
}

public async getRefNames() {
public async getRefNames(opts?: BaseOptions) {
const adapter = await this.configure()
return adapter.getRefNames()
return adapter.getRefNames(opts)
}

public getFeatures(query: Region, opts: BaseOptions) {
public getFeatures(query: Region, opts?: BaseOptions) {
const { statusCallback = () => {}, stopToken } = opts || {}
return ObservableCreate<Feature>(async observer => {
const sequenceAdapter = await this.configure()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import React from 'react'
import {
types,
getParent,
isAlive,
cast,
Instance,
getSnapshot,
} from 'mobx-state-tree'
import { types, getParent, isAlive, cast, Instance } from 'mobx-state-tree'
import { readConfObject } from '@jbrowse/core/configuration'
import {
assembleLocString,
Expand Down
2 changes: 1 addition & 1 deletion plugins/sequence/src/TwoBitAdapter/TwoBitAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class TwoBitAdapter extends BaseSequenceAdapter {
}
async setup() {
if (!this.setupP) {
this.setupP = this.setupPre().catch(e => {
this.setupP = this.setupPre().catch((e: unknown) => {
this.setupP = undefined
throw e
})
Expand Down
17 changes: 17 additions & 0 deletions plugins/wiggle/src/MultiLinearWiggleDisplay/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
// locals
import { getScale, Source, YSCALEBAR_LABEL_OFFSET } from '../util'
import SharedWiggleMixin from '../shared/SharedWiggleMixin'
import { stopStopToken } from '@jbrowse/core/util/stopToken'

const randomColor = () =>
'#000000'.replaceAll('0', () => (~~(Math.random() * 16)).toString(16))
Expand Down Expand Up @@ -67,10 +68,26 @@ export function stateModelFactory(
}),
)
.volatile(() => ({
/**
* #volatile
*/
sourcesLoadingStopToken: undefined as string | undefined,
/**
* #volatile
*/
featureUnderMouseVolatile: undefined as Feature | undefined,
/**
* #volatile
*/
sourcesVolatile: undefined as Source[] | undefined,
}))
.actions(self => ({
setSourcesLoading(str: string) {
if (self.sourcesLoadingStopToken) {
stopStopToken(self.sourcesLoadingStopToken)
}
self.sourcesLoadingStopToken = str
},
/**
* #action
*/
Expand Down
13 changes: 8 additions & 5 deletions plugins/wiggle/src/getMultiWiggleSourcesAutorun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
import { AnyConfigurationModel } from '@jbrowse/core/configuration'
import { getRpcSessionId } from '@jbrowse/core/util/tracks'
import { isAbortException } from '@jbrowse/core/util/aborting'
import { createStopToken } from '@jbrowse/core/util/stopToken'

export interface Source {
name: string
Expand All @@ -19,7 +20,7 @@ export function getMultiWiggleSourcesAutorun(self: {
adapterConfig: AnyConfigurationModel
autoscaleType: string
adapterProps: () => Record<string, unknown>
setStatsLoading: (aborter: AbortController) => void
setSourcesLoading: (aborter: string) => void
setError: (error: unknown) => void
setMessage: (str: string) => void
setSources: (sources: Source[]) => void
Expand All @@ -28,13 +29,15 @@ export function getMultiWiggleSourcesAutorun(self: {
self,
autorun(async () => {
try {
const { rpcManager } = getSession(self)
const { adapterConfig } = self
const sessionId = getRpcSessionId(self)
const view = getContainingView(self) as LinearGenomeViewModel
if (!view.initialized) {
return
}
const { rpcManager } = getSession(self)
const { adapterConfig } = self
const token = createStopToken()
self.setSourcesLoading(token)
const sessionId = getRpcSessionId(self)
const sources = (await rpcManager.call(
sessionId,
'MultiWiggleGetSources',
Expand All @@ -48,8 +51,8 @@ export function getMultiWiggleSourcesAutorun(self: {
self.setSources(sources)
}
} catch (e) {
console.error(e)
if (!isAbortException(e) && isAlive(self)) {
console.error(e)
getSession(self).notifyError(`${e}`, e)
}
}
Expand Down

0 comments on commit 7db2a1c

Please sign in to comment.