@jbrowse/core 4.1.1 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -71,6 +71,14 @@ export function pluginUrl(d) {
71
71
  function isInWebWorker() {
72
72
  return 'WorkerGlobalScope' in globalThis;
73
73
  }
74
+ function addCacheBuster(url) {
75
+ if (!globalThis.__jbrowseCacheBuster) {
76
+ return url;
77
+ }
78
+ const u = new URL(url);
79
+ u.searchParams.set('_cb', Date.now().toString());
80
+ return u.href;
81
+ }
74
82
  export default class PluginLoader {
75
83
  definitions = [];
76
84
  fetchESM;
@@ -100,7 +108,7 @@ export default class PluginLoader {
100
108
  if (!this.fetchESM) {
101
109
  throw new Error('No ESM fetcher installed');
102
110
  }
103
- const plugin = await this.fetchESM(parsedUrl.href);
111
+ const plugin = await this.fetchESM(addCacheBuster(parsedUrl.href));
104
112
  if (!plugin) {
105
113
  throw new Error(`Could not load ESM plugin: ${parsedUrl}`);
106
114
  }
@@ -118,7 +126,7 @@ export default class PluginLoader {
118
126
  const moduleName = def.name;
119
127
  const umdName = `JBrowsePlugin${moduleName}`;
120
128
  if (typeof jest === 'undefined') {
121
- await loadScript(parsedUrl.href);
129
+ await loadScript(addCacheBuster(parsedUrl.href));
122
130
  }
123
131
  else {
124
132
  globalThis[umdName] = { default: Plugin };
@@ -1,4 +1,6 @@
1
1
  import idMaker from "../util/idMaker.js";
2
2
  export function adapterConfigCacheKey(conf = {}) {
3
- return `${idMaker(conf)}`;
3
+ return conf.type && conf.adapterId
4
+ ? `${conf.type}-${conf.adapterId}`
5
+ : `${idMaker(conf)}`;
4
6
  }
@@ -4,6 +4,7 @@ import type { RenderProps, RenderResults } from './RendererType.tsx';
4
4
  import type { SerializedFilterChain } from './util/serializableFilterChain.ts';
5
5
  import type { AnyConfigurationModel } from '../../configuration/index.ts';
6
6
  import type RpcManager from '../../rpc/RpcManager.ts';
7
+ import type { LastStopTokenCheck } from '../../util/stopToken.ts';
7
8
  import type { SnapshotIn, SnapshotOrInstance } from '@jbrowse/mobx-state-tree';
8
9
  import type { ThemeOptions } from '@mui/material';
9
10
  interface BaseRenderArgs extends RenderProps {
@@ -28,6 +29,7 @@ export interface RenderArgsSerialized extends BaseRenderArgs {
28
29
  export interface RenderArgsDeserialized extends BaseRenderArgs {
29
30
  config: AnyConfigurationModel;
30
31
  filters?: SerializableFilterChain;
32
+ stopTokenCheck?: LastStopTokenCheck;
31
33
  }
32
34
  export type ResultsSerialized = Omit<RenderResults, 'reactElement'> & {
33
35
  imageData?: ImageBitmap;
@@ -4,7 +4,7 @@ import RendererType from "./RendererType.js";
4
4
  import SerializableFilterChain from "./util/serializableFilterChain.js";
5
5
  import { getSerializedSvg, updateStatus } from "../../util/index.js";
6
6
  import { isRpcResult } from "../../util/rpc.js";
7
- import { checkStopToken } from "../../util/stopToken.js";
7
+ import { checkStopToken2, createStopTokenChecker, } from "../../util/stopToken.js";
8
8
  function isCanvasRecordedSvgExport(e) {
9
9
  return 'canvasRecordedData' in e;
10
10
  }
@@ -99,13 +99,14 @@ export default class ServerSideRenderer extends RendererType {
99
99
  }
100
100
  async renderInWorker(args) {
101
101
  const { stopToken, statusCallback = () => { } } = args;
102
+ const stopTokenCheck = createStopTokenChecker(stopToken);
102
103
  const args2 = this.deserializeArgsInWorker(args);
103
- const results = await updateStatus('Rendering plot', statusCallback, () => this.render(args2));
104
- checkStopToken(stopToken);
104
+ const results = await updateStatus('Rendering plot', statusCallback, () => this.render({ ...args2, stopTokenCheck }));
105
+ checkStopToken2(stopTokenCheck);
105
106
  if (isRpcResult(results)) {
106
107
  return results;
107
108
  }
108
- return updateStatus('Serializing results', statusCallback, () => this.serializeResultsInWorker(results, args2));
109
+ return updateStatus('Serializing results', statusCallback, () => this.serializeResultsInWorker(results, { ...args2, stopTokenCheck }));
109
110
  }
110
111
  async freeResourcesInClient(rpcManager, args) {
111
112
  const serializedArgs = this.serializeArgsInClient(args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/core",
3
- "version": "4.1.1",
3
+ "version": "4.1.2",
4
4
  "type": "module",
5
5
  "description": "JBrowse 2 core libraries used by plugins",
6
6
  "keywords": [