@vitessce/vit-s 3.0.1 → 3.1.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"VitS.d.ts","sourceRoot":"","sources":["../src/VitS.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;IA7ByB,MAAM,EAApB,MAAM;IAGkB,SAAS,EAAjC,SAAS,GAAC,MAAM;IACF,MAAM,EAApB,MAAM;IACQ,KAAK,EAAnB,MAAM;IAEU,MAAM;IACN,cAAc;IAEd,cAAc;IAEf,cAAc,EAA7B,OAAO;IAIQ,sBAAsB,EAArC,OAAO;IAGY,GAAG,EAAtB,IAAI,GAAC,MAAM;IAGE,SAAS;IACT,SAAS;IACT,cAAc;IACd,iBAAiB;IACX,OAAO,EAA1B,IAAI,GAAC,MAAM;gBAkLrB"}
1
+ {"version":3,"file":"VitS.d.ts","sourceRoot":"","sources":["../src/VitS.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;IA7ByB,MAAM,EAApB,MAAM;IAGkB,SAAS,EAAjC,SAAS,GAAC,MAAM;IACF,MAAM,EAApB,MAAM;IACQ,KAAK,EAAnB,MAAM;IAEU,MAAM;IACN,cAAc;IAEd,cAAc;IAEf,cAAc,EAA7B,OAAO;IAIQ,sBAAsB,EAArC,OAAO;IAGY,GAAG,EAAtB,IAAI,GAAC,MAAM;IAGE,SAAS;IACT,SAAS;IACT,cAAc;IACd,iBAAiB;IACX,OAAO,EAA1B,IAAI,GAAC,MAAM;gBAyLrB"}
package/dist-tsc/VitS.js CHANGED
@@ -55,7 +55,14 @@ export function VitS(props) {
55
55
  // If config.uid exists, then use it for hook dependencies to detect changes
56
56
  // (controlled component case). If not, then use the config object itself
57
57
  // and assume the un-controlled component case.
58
- const configKey = config?.uid || config;
58
+ const configKey = useMemo(() => {
59
+ if (config?.uid) {
60
+ return config.uid;
61
+ }
62
+ // Stringify the config object so it can be used as a key
63
+ // Otherwise, the key will be [object Object]
64
+ return JSON.stringify(config);
65
+ }, [config]);
59
66
  const pluginSpecificConfigSchema = useMemo(() => buildConfigSchema(fileTypes, jointFileTypes, coordinationTypes, viewTypes), [viewTypes, fileTypes, jointFileTypes, coordinationTypes]);
60
67
  // Process the view config and memoize the result:
61
68
  // - Validate.
@@ -135,5 +142,5 @@ export function VitS(props) {
135
142
  return createViewConfigStore(null, null);
136
143
  // eslint-disable-next-line react-hooks/exhaustive-deps
137
144
  }, [success, configKey]);
138
- return success ? (_jsx(StylesProvider, { generateClassName: generateClassName, children: _jsx(ThemeProvider, { theme: muiTheme[theme], children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(ViewConfigProvider, { createStore: createViewConfigStoreClosure, children: _jsxs(AuxiliaryProvider, { createStore: createAuxiliaryStore, children: [_jsx(VitessceGrid, { success: success, configKey: configKey, viewTypes: viewTypes, fileTypes: fileTypes, coordinationTypes: coordinationTypes, config: configOrWarning, rowHeight: rowHeight, height: height, theme: theme, isBounded: isBounded }), _jsx(CallbackPublisher, { onWarn: onWarn, onConfigChange: onConfigChange, onLoaderChange: onLoaderChange, validateOnConfigChange: validateOnConfigChange, pluginSpecificConfigSchema: pluginSpecificConfigSchema })] }) }) }) }) })) : (_jsx(StylesProvider, { generateClassName: generateClassName, children: _jsx(ThemeProvider, { theme: muiTheme[theme], children: _jsx(Warning, { ...configOrWarning }) }) }));
145
+ return success ? (_jsx(StylesProvider, { generateClassName: generateClassName, children: _jsx(ThemeProvider, { theme: muiTheme[theme], children: _jsx(QueryClientProvider, { client: queryClient, children: _jsx(ViewConfigProvider, { createStore: createViewConfigStoreClosure, children: _jsxs(AuxiliaryProvider, { createStore: createAuxiliaryStore, children: [_jsx(VitessceGrid, { success: success, configKey: configKey, viewTypes: viewTypes, fileTypes: fileTypes, coordinationTypes: coordinationTypes, config: configOrWarning, rowHeight: rowHeight, height: height, theme: theme, isBounded: isBounded }), _jsx(CallbackPublisher, { onWarn: onWarn, onConfigChange: onConfigChange, onLoaderChange: onLoaderChange, validateOnConfigChange: validateOnConfigChange, pluginSpecificConfigSchema: pluginSpecificConfigSchema })] }) }, configKey) }) }) })) : (_jsx(StylesProvider, { generateClassName: generateClassName, children: _jsx(ThemeProvider, { theme: muiTheme[theme], children: _jsx(Warning, { ...configOrWarning }) }) }));
139
146
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.js"],"names":[],"mappings":"AAkBA,oDAOC;AAED;;;;GAIG;AACH,6CAgBC;AAED;;;;GAIG;AACH,yCAiCC;AAED;;;;;GAKG;AACH,2CAiCC;AAED;;;;;;GAMG;AACH,uCAHW,MAAM,EAAE,GACN,OAAO,CAOnB;AAED;;;;GAIG;AACH,8BAHW,CAAC,IAAI,GAAC,MAAM,EAAE,CAAC,EAAE,SAU3B;AAED;;;;;;GAMG;AACH,iEAuBC;AAED;;;;;;;;;;GAUG;AACH;IAR0B,gBAAgB,EAA/B,MAAM;UAqBhB;AAED;;;;;;;;;;GAUG;AACH,yDARW,QAAM,IAAI,SAuBpB;AAED;;;;QA2BC;AAED,iEAOC;AAED,kHAuBC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.js"],"names":[],"mappings":"AAkBA,oDAOC;AAED;;;;GAIG;AACH,6CAgBC;AAED;;;;GAIG;AACH,yCAiCC;AAED;;;;;GAKG;AACH,2CAiCC;AAED;;;;;;GAMG;AACH,uCAHW,MAAM,EAAE,GACN,OAAO,CAOnB;AAED;;;;GAIG;AACH,8BAHW,CAAC,IAAI,GAAC,MAAM,EAAE,CAAC,EAAE,SAa3B;AAED;;;;;;GAMG;AACH,iEAuBC;AAED;;;;;;;;;;GAUG;AACH;IAR0B,gBAAgB,EAA/B,MAAM;UAqBhB;AAED;;;;;;;;;;GAUG;AACH,yDARW,QAAM,IAAI,SAuBpB;AAED;;;;QA2BC;AAED,iEAOC;AAED,kHAuBC"}
package/dist-tsc/hooks.js CHANGED
@@ -124,7 +124,10 @@ export function useReady(statusValues) {
124
124
  * @returns {array} An array of { url, name } objects (flattened from the input).
125
125
  */
126
126
  export function useUrls(urls) {
127
- const mergedUrls = useMemo(() => urls.filter(a => Array.isArray(a)).flat(),
127
+ const mergedUrls = useMemo(() => urls.filter(a => Array.isArray(a)).flat().filter((url, index, array) => {
128
+ const firstIndex = array.findIndex(u => u.name === url.name);
129
+ return index === firstIndex;
130
+ }),
128
131
  // eslint-disable-next-line react-hooks/exhaustive-deps
129
132
  urls);
130
133
  return mergedUrls;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/vit-s",
3
- "version": "3.0.1",
3
+ "version": "3.1.1",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -28,10 +28,10 @@
28
28
  "react-grid-layout-with-lodash": "^1.3.5",
29
29
  "uuid": "^9.0.0",
30
30
  "zustand": "^3.5.10",
31
- "@vitessce/constants-internal": "3.0.1",
32
- "@vitessce/plugins": "3.0.1",
33
- "@vitessce/schemas": "3.0.1",
34
- "@vitessce/utils": "3.0.1"
31
+ "@vitessce/constants-internal": "3.1.1",
32
+ "@vitessce/plugins": "3.1.1",
33
+ "@vitessce/schemas": "3.1.1",
34
+ "@vitessce/utils": "3.1.1"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@testing-library/jest-dom": "^5.16.4",
package/src/VitS.js CHANGED
@@ -98,7 +98,14 @@ export function VitS(props) {
98
98
  // If config.uid exists, then use it for hook dependencies to detect changes
99
99
  // (controlled component case). If not, then use the config object itself
100
100
  // and assume the un-controlled component case.
101
- const configKey = config?.uid || config;
101
+ const configKey = useMemo(() => {
102
+ if (config?.uid) {
103
+ return config.uid;
104
+ }
105
+ // Stringify the config object so it can be used as a key
106
+ // Otherwise, the key will be [object Object]
107
+ return JSON.stringify(config);
108
+ }, [config]);
102
109
 
103
110
  const pluginSpecificConfigSchema = useMemo(() => buildConfigSchema(
104
111
  fileTypes,
@@ -202,7 +209,7 @@ export function VitS(props) {
202
209
  <StylesProvider generateClassName={generateClassName}>
203
210
  <ThemeProvider theme={muiTheme[theme]}>
204
211
  <QueryClientProvider client={queryClient}>
205
- <ViewConfigProvider createStore={createViewConfigStoreClosure}>
212
+ <ViewConfigProvider key={configKey} createStore={createViewConfigStoreClosure}>
206
213
  <AuxiliaryProvider createStore={createAuxiliaryStore}>
207
214
  <VitessceGrid
208
215
  success={success}
package/src/hooks.js CHANGED
@@ -150,7 +150,10 @@ export function useReady(statusValues) {
150
150
  */
151
151
  export function useUrls(urls) {
152
152
  const mergedUrls = useMemo(
153
- () => urls.filter(a => Array.isArray(a)).flat(),
153
+ () => urls.filter(a => Array.isArray(a)).flat().filter((url, index, array) => {
154
+ const firstIndex = array.findIndex(u => u.name === url.name);
155
+ return index === firstIndex;
156
+ }),
154
157
  // eslint-disable-next-line react-hooks/exhaustive-deps
155
158
  urls,
156
159
  );