diff --git a/plugins/circular-view/src/BaseChordDisplay/models/model.tsx b/plugins/circular-view/src/BaseChordDisplay/models/model.tsx index 802879222f..af6ca386c8 100644 --- a/plugins/circular-view/src/BaseChordDisplay/models/model.tsx +++ b/plugins/circular-view/src/BaseChordDisplay/models/model.tsx @@ -249,16 +249,14 @@ export const BaseChordDisplayModel = types makeAbortableReaction( self, - () => - ({ + () => { + return { assemblyNames: getTrackAssemblyNames(self.parentTrack), adapter: getConf(getParent(self, 2), 'adapter'), assemblyManager: getSession(self).assemblyManager, - }) as const, + } as const + }, async (args, stopToken) => { - if (!args) { - return - } return args ? args.assemblyManager.getRefNameMapForAdapter( args.adapter, diff --git a/plugins/circular-view/src/BaseChordDisplay/models/renderReaction.ts b/plugins/circular-view/src/BaseChordDisplay/models/renderReaction.ts index 5d93ca2a8a..a77fc7c616 100644 --- a/plugins/circular-view/src/BaseChordDisplay/models/renderReaction.ts +++ b/plugins/circular-view/src/BaseChordDisplay/models/renderReaction.ts @@ -54,6 +54,7 @@ export async function renderReactionEffect(props?: any, stopToken?: string) { ...renderProps, stopToken, exportSVG, + stopToken, }) return { diff --git a/plugins/gccontent/src/GCContentAdapter/GCContentAdapter.ts b/plugins/gccontent/src/GCContentAdapter/GCContentAdapter.ts index 9d09f34791..5335822566 100644 --- a/plugins/gccontent/src/GCContentAdapter/GCContentAdapter.ts +++ b/plugins/gccontent/src/GCContentAdapter/GCContentAdapter.ts @@ -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(async observer => { const sequenceAdapter = await this.configure() diff --git a/plugins/linear-genome-view/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts b/plugins/linear-genome-view/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts index 8cce078a1a..2f87572369 100644 --- a/plugins/linear-genome-view/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +++ b/plugins/linear-genome-view/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts @@ -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, diff --git a/plugins/sequence/src/TwoBitAdapter/TwoBitAdapter.ts b/plugins/sequence/src/TwoBitAdapter/TwoBitAdapter.ts index bf47486e55..e180026bbe 100644 --- a/plugins/sequence/src/TwoBitAdapter/TwoBitAdapter.ts +++ b/plugins/sequence/src/TwoBitAdapter/TwoBitAdapter.ts @@ -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 }) diff --git a/plugins/wiggle/src/MultiLinearWiggleDisplay/model.ts b/plugins/wiggle/src/MultiLinearWiggleDisplay/model.ts index af724f5161..95728e0af3 100644 --- a/plugins/wiggle/src/MultiLinearWiggleDisplay/model.ts +++ b/plugins/wiggle/src/MultiLinearWiggleDisplay/model.ts @@ -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)) @@ -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 */ diff --git a/plugins/wiggle/src/getMultiWiggleSourcesAutorun.ts b/plugins/wiggle/src/getMultiWiggleSourcesAutorun.ts index c0f0417dae..d5b5b6b017 100644 --- a/plugins/wiggle/src/getMultiWiggleSourcesAutorun.ts +++ b/plugins/wiggle/src/getMultiWiggleSourcesAutorun.ts @@ -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 @@ -19,7 +20,7 @@ export function getMultiWiggleSourcesAutorun(self: { adapterConfig: AnyConfigurationModel autoscaleType: string adapterProps: () => Record - setStatsLoading: (aborter: AbortController) => void + setSourcesLoading: (aborter: string) => void setError: (error: unknown) => void setMessage: (str: string) => void setSources: (sources: Source[]) => void @@ -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', @@ -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) } }