@teambit/workspace 1.0.1110 → 1.0.1113

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.
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/workspace",
3
- "version": "1.0.1110",
3
+ "version": "1.0.1113",
4
4
  "homepage": "https://bit.cloud/teambit/workspace/workspace",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.workspace",
8
8
  "name": "workspace",
9
- "version": "1.0.1110"
9
+ "version": "1.0.1113"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -94,29 +94,29 @@
94
94
  "@teambit/workspace.hooks.use-url-change-broadcaster": "0.0.2",
95
95
  "@teambit/workspace.ui.preserve-workspace-mode": "0.0.3",
96
96
  "@teambit/evangelist.elements.icon": "1.0.5",
97
- "@teambit/component": "1.0.1110",
98
- "@teambit/dependency-resolver": "1.0.1110",
99
- "@teambit/envs": "1.0.1110",
100
- "@teambit/logger": "0.0.1461",
101
- "@teambit/objects": "0.0.617",
102
- "@teambit/scope": "1.0.1110",
103
- "@teambit/graph": "1.0.1110",
104
- "@teambit/cli": "0.0.1368",
105
- "@teambit/config-store": "0.0.249",
106
- "@teambit/isolator": "1.0.1110",
107
- "@teambit/component-tree": "1.0.1110",
108
- "@teambit/watcher": "1.0.1110",
109
- "@teambit/aspect-loader": "1.0.1110",
110
- "@teambit/config": "0.0.1543",
111
- "@teambit/graphql": "1.0.1110",
112
- "@teambit/bundler": "1.0.1110",
113
- "@teambit/global-config": "0.0.1372",
114
- "@teambit/ui": "1.0.1110",
115
- "@teambit/variants": "0.0.1636",
116
- "@teambit/command-bar": "1.0.1110",
117
- "@teambit/sidebar": "1.0.1110",
118
- "@teambit/pubsub": "1.0.1110",
119
- "@teambit/deprecation": "1.0.1110"
97
+ "@teambit/component": "1.0.1113",
98
+ "@teambit/dependency-resolver": "1.0.1113",
99
+ "@teambit/envs": "1.0.1113",
100
+ "@teambit/logger": "0.0.1464",
101
+ "@teambit/objects": "0.0.620",
102
+ "@teambit/scope": "1.0.1113",
103
+ "@teambit/graph": "1.0.1113",
104
+ "@teambit/cli": "0.0.1371",
105
+ "@teambit/config-store": "0.0.252",
106
+ "@teambit/isolator": "1.0.1113",
107
+ "@teambit/component-tree": "1.0.1113",
108
+ "@teambit/watcher": "1.0.1113",
109
+ "@teambit/aspect-loader": "1.0.1113",
110
+ "@teambit/config": "0.0.1546",
111
+ "@teambit/graphql": "1.0.1113",
112
+ "@teambit/bundler": "1.0.1113",
113
+ "@teambit/global-config": "0.0.1375",
114
+ "@teambit/ui": "1.0.1113",
115
+ "@teambit/variants": "0.0.1639",
116
+ "@teambit/command-bar": "1.0.1113",
117
+ "@teambit/sidebar": "1.0.1113",
118
+ "@teambit/pubsub": "1.0.1113",
119
+ "@teambit/deprecation": "1.0.1113"
120
120
  },
121
121
  "devDependencies": {
122
122
  "@types/lodash": "4.14.165",
@@ -905,7 +905,15 @@ export class WorkspaceComponentLoader {
905
905
  }
906
906
 
907
907
  clearComponentCache(id: ComponentID) {
908
- const idStr = id.toString();
908
+ this.clearComponentsCache([id]);
909
+ }
910
+
911
+ /**
912
+ * bulk version of clearComponentCache. scans each cache once for all the given ids, rather
913
+ * than once per id, so clearing many components stays cheap.
914
+ */
915
+ clearComponentsCache(ids: ComponentID[]) {
916
+ const idsStr = new Set(ids.map((id) => id.toString()));
909
917
  const cachesToClear = [
910
918
  this.componentsCache,
911
919
  this.scopeComponentsCache,
@@ -914,7 +922,9 @@ export class WorkspaceComponentLoader {
914
922
  ];
915
923
  cachesToClear.forEach((cache) => {
916
924
  for (const cacheKey of cache.keys()) {
917
- if (cacheKey === idStr || cacheKey.startsWith(`${idStr}:`)) {
925
+ // the cache key is either the id-str alone or `${idStr}:${loadOptsStr}`
926
+ const cacheKeyIdStr = cacheKey.split(':')[0];
927
+ if (idsStr.has(cacheKeyIdStr)) {
918
928
  cache.delete(cacheKey);
919
929
  }
920
930
  }