@next-core/brick-kit 2.145.3 → 2.146.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.146.1](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.146.0...@next-core/brick-kit@2.146.1) (2022-09-28)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix standalone jump problem ([e61c446](https://github.com/easyops-cn/next-core/commit/e61c446e70bc9421977c045962d8e70e226df14e))
12
+
13
+
14
+
15
+
16
+
17
+ # [2.146.0](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.145.3...@next-core/brick-kit@2.146.0) (2022-09-28)
18
+
19
+
20
+ ### Features
21
+
22
+ * **StoryboardContext:** move logic of track into resolveFreeVariableValue to support tracking state in useBrick ([62b8445](https://github.com/easyops-cn/next-core/commit/62b8445b28e20c6b12e0eda7b3711d83a2be365c))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [2.145.3](https://github.com/easyops-cn/next-core/compare/@next-core/brick-kit@2.145.2...@next-core/brick-kit@2.145.3) (2022-09-27)
7
29
 
8
30
 
@@ -2180,26 +2180,6 @@
2180
2180
  // Or if the resolve is ignored or lazy, use its `value` as a fallback.
2181
2181
  value = computeRealValue(contextConf.value, mergedContext, true);
2182
2182
  }
2183
-
2184
- if (contextConf.track) {
2185
- // Track its dependencies and auto update when each of them changed.
2186
- var deps = (isTemplateState ? brickUtils.trackUsedState : brickUtils.trackUsedContext)(load ? contextConf.resolve : contextConf.value);
2187
-
2188
- for (var dep of deps) {
2189
- var _eventTarget;
2190
-
2191
- var ctx = storyboardContextWrapper.get().get(dep);
2192
- ctx === null || ctx === void 0 ? void 0 : (_eventTarget = ctx.eventTarget) === null || _eventTarget === void 0 ? void 0 : _eventTarget.addEventListener(isTemplateState ? "state.change" : "context.change", () => {
2193
- if (load) {
2194
- storyboardContextWrapper.updateValue(contextConf.name, {
2195
- cache: "default"
2196
- }, "refresh");
2197
- } else {
2198
- storyboardContextWrapper.updateValue(contextConf.name, computeRealValue(contextConf.value, mergedContext, true), "replace");
2199
- }
2200
- });
2201
- }
2202
- }
2203
2183
  }
2204
2184
 
2205
2185
  resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, load, !isLazyResolve);
@@ -2249,6 +2229,27 @@
2249
2229
  }
2250
2230
  }
2251
2231
 
2232
+ if (contextConf.track) {
2233
+ var isTemplateState = !!storyboardContextWrapper.tplContextId; // Track its dependencies and auto update when each of them changed.
2234
+
2235
+ var deps = (isTemplateState ? brickUtils.trackUsedState : brickUtils.trackUsedContext)(load ? contextConf.resolve : contextConf.value);
2236
+
2237
+ for (var dep of deps) {
2238
+ var _eventTarget;
2239
+
2240
+ var ctx = storyboardContextWrapper.get().get(dep);
2241
+ ctx === null || ctx === void 0 ? void 0 : (_eventTarget = ctx.eventTarget) === null || _eventTarget === void 0 ? void 0 : _eventTarget.addEventListener(isTemplateState ? "state.change" : "context.change", () => {
2242
+ if (load) {
2243
+ storyboardContextWrapper.updateValue(contextConf.name, {
2244
+ cache: "default"
2245
+ }, "refresh");
2246
+ } else {
2247
+ storyboardContextWrapper.updateValue(contextConf.name, computeRealValue(contextConf.value, mergedContext, true), "replace");
2248
+ }
2249
+ });
2250
+ }
2251
+ }
2252
+
2252
2253
  storyboardContextWrapper.set(contextConf.name, newContext);
2253
2254
  }
2254
2255
 
@@ -12019,16 +12020,16 @@
12019
12020
 
12020
12021
  _this.locationContext.messageDispatcher.reset();
12021
12022
 
12022
- var storyboard = _this.locationContext.matchStoryboard(_this.kernel.bootstrapData.storyboards, location);
12023
+ var storyboard = _this.locationContext.matchStoryboard(_this.kernel.bootstrapData.storyboards, location); // Whether non-standalone app to standalone app, or standlone app to non-standalone app
12024
+ // window should reload to refresh the resource
12025
+
12023
12026
 
12024
12027
  if (!window.STANDALONE_MICRO_APPS) {
12025
12028
  if (storyboard && storyboard.app.standaloneMode) {
12026
- // from non-standalone app to standalone app, should jump out off site
12027
- window.location.assign(window.location.href);
12029
+ window.location.reload();
12028
12030
  }
12029
12031
  } else {
12030
12032
  if (!storyboard) {
12031
- // from standalone app goback to non-standalone app, should reload
12032
12033
  window.location.reload();
12033
12034
  }
12034
12035
  }