diff --git a/products/jbrowse-react-linear-genome-view/package.json b/products/jbrowse-react-linear-genome-view/package.json index a20a5c7c498..490e70c4410 100644 --- a/products/jbrowse-react-linear-genome-view/package.json +++ b/products/jbrowse-react-linear-genome-view/package.json @@ -59,12 +59,14 @@ "@jbrowse/plugin-wiggle": "^2.1.5", "@mui/icons-material": "^5.0.0", "@mui/material": "^5.0.0", + "librpc-web-mod": "^1.1.5", "mobx": "^6.6.0", "mobx-react": "^7.5.0", "mobx-state-tree": "^5.0.0", "prop-types": "^15.0.0", "react-use-measure": "^2.1.1", "rxjs": "^6.0.0", + "serialize-error": "^8.0.0", "tss-react": "^3.7.0" }, "peerDependencies": { diff --git a/products/jbrowse-react-linear-genome-view/src/createModel/createModel.ts b/products/jbrowse-react-linear-genome-view/src/createModel/createModel.ts index 706dc5b5d3f..00637e714ba 100644 --- a/products/jbrowse-react-linear-genome-view/src/createModel/createModel.ts +++ b/products/jbrowse-react-linear-genome-view/src/createModel/createModel.ts @@ -12,9 +12,10 @@ import createSessionModel from './createSessionModel' export default function createModel( runtimePlugins: PluginConstructor[], - makeWorkerInstance: () => any, + makeWorkerInstance: () => any = () => { + throw new Error('no makeWorkerInstance supplied') + }, ) { - console.log({ makeWorkerInstance }) const pluginManager = new PluginManager( [...corePlugins, ...runtimePlugins].map(P => new P()), ) diff --git a/products/jbrowse-react-linear-genome-view/src/createViewState.ts b/products/jbrowse-react-linear-genome-view/src/createViewState.ts index 2d50b1092dc..9c7ce0c6c2a 100644 --- a/products/jbrowse-react-linear-genome-view/src/createViewState.ts +++ b/products/jbrowse-react-linear-genome-view/src/createViewState.ts @@ -29,6 +29,7 @@ interface ViewStateOptions { defaultSession?: SessionSnapshot disableAddTracks?: boolean onChange?: (patch: IJsonPatch, reversePatch: IJsonPatch) => void + makeWorkerInstance?: () => any } export default function createViewState(opts: ViewStateOptions) { @@ -41,8 +42,12 @@ export default function createViewState(opts: ViewStateOptions) { location, onChange, disableAddTracks = false, + makeWorkerInstance, } = opts - const { model, pluginManager } = createModel(plugins || []) + const { model, pluginManager } = createModel( + plugins || [], + makeWorkerInstance, + ) let { defaultSession } = opts if (!defaultSession) { defaultSession = { diff --git a/products/jbrowse-react-linear-genome-view/src/index.ts b/products/jbrowse-react-linear-genome-view/src/index.ts index cbf8c384c80..4732a875728 100644 --- a/products/jbrowse-react-linear-genome-view/src/index.ts +++ b/products/jbrowse-react-linear-genome-view/src/index.ts @@ -2,6 +2,6 @@ export { createJBrowseTheme, ThemeProvider } from './deprecations' export { default as JBrowseLinearGenomeView } from './JBrowseLinearGenomeView' export { default as createModel } from './createModel' export { default as createViewState } from './createViewState' +export { default as makeWorkerInstance } from './makeWorkerInstance' export { default as loadPlugins } from './loadPlugins' export type { ViewModel } from './createModel/createModel' -export { makeWorkerInstance } from './makeWorkerInstance' diff --git a/products/jbrowse-react-linear-genome-view/src/makeWorkerInstance.ts b/products/jbrowse-react-linear-genome-view/src/makeWorkerInstance.ts index 938e73e80e8..2258d030a96 100644 --- a/products/jbrowse-react-linear-genome-view/src/makeWorkerInstance.ts +++ b/products/jbrowse-react-linear-genome-view/src/makeWorkerInstance.ts @@ -10,6 +10,5 @@ // also note: the craco config for webpack publicPath: 'auto' is needed for // these workers export default function makeWorkerInstance() { - console.log('t2') return new Worker(new URL('./rpc.worker.ts', import.meta.url)) } diff --git a/products/jbrowse-react-linear-genome-view/src/rpc.worker.ts b/products/jbrowse-react-linear-genome-view/src/rpc.worker.ts index 102042fbd70..7617c7ec960 100644 --- a/products/jbrowse-react-linear-genome-view/src/rpc.worker.ts +++ b/products/jbrowse-react-linear-genome-view/src/rpc.worker.ts @@ -10,8 +10,6 @@ import { remoteAbortRpcHandler } from '@jbrowse/core/rpc/remoteAbortSignals' import PluginLoader, { PluginDefinition } from '@jbrowse/core/PluginLoader' import { serializeError } from 'serialize-error' -console.log('t1') - // locals import corePlugins from './corePlugins' diff --git a/products/jbrowse-react-linear-genome-view/stories/JBrowseLinearGenomeView.stories.tsx b/products/jbrowse-react-linear-genome-view/stories/JBrowseLinearGenomeView.stories.tsx index 41a599be429..29e1353a0dc 100644 --- a/products/jbrowse-react-linear-genome-view/stories/JBrowseLinearGenomeView.stories.tsx +++ b/products/jbrowse-react-linear-genome-view/stories/JBrowseLinearGenomeView.stories.tsx @@ -8,7 +8,12 @@ import PluginManager from '@jbrowse/core/PluginManager' import Plugin from '@jbrowse/core/Plugin' // locals -import { createViewState, loadPlugins, JBrowseLinearGenomeView } from '../src' +import { + createViewState, + loadPlugins, + makeWorkerInstance, + JBrowseLinearGenomeView, +} from '../src' // configs import volvoxConfig from '../public/test_data/volvox/config.json' @@ -67,6 +72,7 @@ export const WithWebWorker = () => { defaultDriver: 'WebWorkerRpcDriver', }, }, + makeWorkerInstance, }) return } diff --git a/products/jbrowse-web/src/Loader.tsx b/products/jbrowse-web/src/Loader.tsx index 67adc9cbb44..33c660d351f 100644 --- a/products/jbrowse-web/src/Loader.tsx +++ b/products/jbrowse-web/src/Loader.tsx @@ -298,6 +298,7 @@ const Renderer = observer( try { if (sessionError) { rootModel.setDefaultSession() + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion rootModel.session!.notify( `Error loading session: ${sessionError}. If you received this URL from another user, request that they send you