@xh/hoist 80.0.0 → 80.0.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
|
@@ -89,6 +89,8 @@ export declare class Cube extends HoistBase {
|
|
|
89
89
|
get records(): StoreRecord[];
|
|
90
90
|
/** True if this Cube contains no data / records. */
|
|
91
91
|
get empty(): boolean;
|
|
92
|
+
/** Timestamp (ms) of when the Cube data was last updated */
|
|
93
|
+
get lastUpdated(): number;
|
|
92
94
|
/** Count of currently connected, auto-updating Views. */
|
|
93
95
|
get connectedViewCount(): number;
|
|
94
96
|
getField(name: string): CubeField;
|
|
@@ -46,9 +46,11 @@ export declare class View extends HoistBase implements FilterBindTarget, FilterV
|
|
|
46
46
|
result: ViewResult;
|
|
47
47
|
/** Stores to which results of this view should be (re)loaded. */
|
|
48
48
|
stores: Store[];
|
|
49
|
-
/** The source {@link Cube.info} as of the last time
|
|
49
|
+
/** The source {@link Cube.info} as of the last time the view was updated. */
|
|
50
50
|
info: PlainObject;
|
|
51
|
-
/**
|
|
51
|
+
/** The source {@link Cube.lastUpdated} as of the last time the view was updated. */
|
|
52
|
+
cubeUpdated: number;
|
|
53
|
+
/** Timestamp (ms) when the view was last updated. */
|
|
52
54
|
lastUpdated: number;
|
|
53
55
|
private _rowDatas;
|
|
54
56
|
private _leafMap;
|
package/data/cube/Cube.ts
CHANGED
|
@@ -155,6 +155,11 @@ export class Cube extends HoistBase {
|
|
|
155
155
|
return this.store.empty;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
+
/** Timestamp (ms) of when the Cube data was last updated */
|
|
159
|
+
get lastUpdated(): number {
|
|
160
|
+
return this.store.lastUpdated;
|
|
161
|
+
}
|
|
162
|
+
|
|
158
163
|
/** Count of currently connected, auto-updating Views. */
|
|
159
164
|
get connectedViewCount(): number {
|
|
160
165
|
return this._connectedViews.size;
|
|
@@ -234,7 +239,7 @@ export class Cube extends HoistBase {
|
|
|
234
239
|
this._connectedViews.add(view);
|
|
235
240
|
|
|
236
241
|
// If the view is not up-to-date with the current cube data, then reload the view
|
|
237
|
-
if (view.
|
|
242
|
+
if (view.cubeUpdated !== this.lastUpdated) {
|
|
238
243
|
view.noteCubeLoaded();
|
|
239
244
|
}
|
|
240
245
|
}
|
package/data/cube/View.ts
CHANGED
|
@@ -91,11 +91,15 @@ export class View
|
|
|
91
91
|
/** Stores to which results of this view should be (re)loaded. */
|
|
92
92
|
stores: Store[] = null;
|
|
93
93
|
|
|
94
|
-
/** The source {@link Cube.info} as of the last time
|
|
94
|
+
/** The source {@link Cube.info} as of the last time the view was updated. */
|
|
95
95
|
@observable.ref
|
|
96
96
|
info: PlainObject = null;
|
|
97
97
|
|
|
98
|
-
/**
|
|
98
|
+
/** The source {@link Cube.lastUpdated} as of the last time the view was updated. */
|
|
99
|
+
@observable
|
|
100
|
+
cubeUpdated: number;
|
|
101
|
+
|
|
102
|
+
/** Timestamp (ms) when the view was last updated. */
|
|
99
103
|
@observable
|
|
100
104
|
lastUpdated: number;
|
|
101
105
|
|
|
@@ -184,6 +188,7 @@ export class View
|
|
|
184
188
|
|
|
185
189
|
if (oldCube !== newCube) {
|
|
186
190
|
this.info = null;
|
|
191
|
+
this.cubeUpdated = null;
|
|
187
192
|
this._rowCache.clear();
|
|
188
193
|
|
|
189
194
|
if (oldCube.viewIsConnected(this)) {
|
|
@@ -251,6 +256,7 @@ export class View
|
|
|
251
256
|
this.dataOnlyUpdate(simpleUpdates);
|
|
252
257
|
} else {
|
|
253
258
|
this.info = this.cube.info;
|
|
259
|
+
this.cubeUpdated = this.cube.lastUpdated;
|
|
254
260
|
}
|
|
255
261
|
}
|
|
256
262
|
|
|
@@ -309,6 +315,7 @@ export class View
|
|
|
309
315
|
const {_leafMap, _rowDatas} = this;
|
|
310
316
|
this.result = {rows: _rowDatas, leafMap: _leafMap};
|
|
311
317
|
this.info = this.cube.info;
|
|
318
|
+
this.cubeUpdated = this.cube.lastUpdated;
|
|
312
319
|
this.lastUpdated = Date.now();
|
|
313
320
|
}
|
|
314
321
|
|