Skip to content

Commit cd1ead6

Browse files
authored
Suspend on browser idle (#2088)
* Add disable on inactive feature ConnectionManager now offers two new methods - disableAllActiveSubscriptions - enableAllActiveSubscriptions * ui library version 0.13.114
1 parent 94f543c commit cd1ead6

48 files changed

Lines changed: 642 additions & 556 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

vuu-ui/package-lock.json

Lines changed: 218 additions & 218 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vuu-ui/packages/grid-layout/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@heswell/grid-layout",
3-
"version": "0.13.113",
3+
"version": "0.13.114",
44
"description": "VUU Layout Components",
55
"main": "src/index.ts",
66
"author": "heswell",
@@ -12,7 +12,7 @@
1212
},
1313
"types": "src/index.ts",
1414
"dependencies": {
15-
"@vuu-ui/vuu-utils": "0.13.113",
15+
"@vuu-ui/vuu-utils": "0.13.114",
1616
"@salt-ds/core": "1.54.1",
1717
"@salt-ds/lab": "1.0.0-alpha.83",
1818
"@salt-ds/styles": "0.2.1",

vuu-ui/packages/vuu-codemirror/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vuu-ui/vuu-codemirror",
3-
"version": "0.13.113",
3+
"version": "0.13.114",
44
"author": "heswell",
55
"main": "src/index.ts",
66
"license": "Apache-2.0",
@@ -11,15 +11,15 @@
1111
"lezer-generate:column": "lezer-generator --output ./src/column-expression-input/column-language-parser/generated/column-parser.js ./src/column-expression-input/column-language-parser/grammar/column.grammar"
1212
},
1313
"devDependencies": {
14-
"@vuu-ui/vuu-table-types": "0.13.113"
14+
"@vuu-ui/vuu-table-types": "0.13.114"
1515
},
1616
"dependencies": {
1717
"@codemirror/autocomplete": "^6.4.2",
1818
"@codemirror/commands": "^6.2.1",
1919
"@codemirror/language": "^6.6.0",
2020
"@codemirror/state": "^6.2.0",
2121
"@codemirror/view": "^6.9.3",
22-
"@vuu-ui/vuu-utils": "0.13.113",
22+
"@vuu-ui/vuu-utils": "0.13.114",
2323
"@lezer/common": "1.2.3",
2424
"@lezer/highlight": "^1.1.3"
2525
},

vuu-ui/packages/vuu-context-menu/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vuu-ui/vuu-context-menu",
3-
"version": "0.13.113",
3+
"version": "0.13.114",
44
"author": "heswell",
55
"main": "src/index.ts",
66
"license": "Apache-2.0",
@@ -10,12 +10,12 @@
1010
"type-defs": "node ../../scripts/build-type-defs.mjs"
1111
},
1212
"devDependencies": {
13-
"@vuu-ui/vuu-data-types": "0.13.113",
14-
"@vuu-ui/vuu-protocol-types": "0.13.113",
15-
"@vuu-ui/vuu-table-types": "0.13.113"
13+
"@vuu-ui/vuu-data-types": "0.13.114",
14+
"@vuu-ui/vuu-protocol-types": "0.13.114",
15+
"@vuu-ui/vuu-table-types": "0.13.114"
1616
},
1717
"dependencies": {
18-
"@vuu-ui/vuu-utils": "0.13.113",
18+
"@vuu-ui/vuu-utils": "0.13.114",
1919
"@salt-ds/core": "1.54.1",
2020
"@salt-ds/styles": "0.2.1",
2121
"@salt-ds/window": "0.1.1"
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vuu-ui/vuu-data-local",
3-
"version": "0.13.113",
3+
"version": "0.13.114",
44
"main": "src/index.ts",
55
"author": "heswell",
66
"license": "Apache-2.0",
@@ -11,14 +11,14 @@
1111
"type-defs": "node ../../scripts/build-type-defs.mjs"
1212
},
1313
"devDependencies": {
14-
"@vuu-ui/vuu-data-types": "0.13.113",
15-
"@vuu-ui/vuu-table-types": "0.13.113",
16-
"@vuu-ui/vuu-filter-types": "0.13.113",
17-
"@vuu-ui/vuu-protocol-types": "0.13.113"
14+
"@vuu-ui/vuu-data-types": "0.13.114",
15+
"@vuu-ui/vuu-table-types": "0.13.114",
16+
"@vuu-ui/vuu-filter-types": "0.13.114",
17+
"@vuu-ui/vuu-protocol-types": "0.13.114"
1818
},
1919
"dependencies": {
20-
"@vuu-ui/vuu-filter-parser": "0.13.113",
21-
"@vuu-ui/vuu-utils": "0.13.113"
20+
"@vuu-ui/vuu-filter-parser": "0.13.114",
21+
"@vuu-ui/vuu-utils": "0.13.114"
2222
},
2323
"sideEffects": false
2424
}

vuu-ui/packages/vuu-data-react/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vuu-ui/vuu-data-react",
3-
"version": "0.13.113",
3+
"version": "0.13.114",
44
"main": "src/index.ts",
55
"author": "heswell",
66
"license": "Apache-2.0",
@@ -11,21 +11,21 @@
1111
"type-defs": "node ../../scripts/build-type-defs.mjs"
1212
},
1313
"devDependencies": {
14-
"@vuu-ui/vuu-data-types": "0.13.113",
15-
"@vuu-ui/vuu-filter-types": "0.13.113",
16-
"@vuu-ui/vuu-protocol-types": "0.13.113",
17-
"@vuu-ui/vuu-table-types": "0.13.113"
14+
"@vuu-ui/vuu-data-types": "0.13.114",
15+
"@vuu-ui/vuu-filter-types": "0.13.114",
16+
"@vuu-ui/vuu-protocol-types": "0.13.114",
17+
"@vuu-ui/vuu-table-types": "0.13.114"
1818
},
1919
"dependencies": {
20-
"@vuu-ui/vuu-context-menu": "0.13.113",
21-
"@vuu-ui/vuu-data-remote": "0.13.113",
22-
"@vuu-ui/vuu-filter-parser": "0.13.113",
23-
"@vuu-ui/vuu-filters": "0.13.113",
24-
"@vuu-ui/vuu-layout": "0.13.113",
25-
"@vuu-ui/vuu-notifications": "0.13.113",
26-
"@vuu-ui/vuu-ui-controls": "0.13.113",
27-
"@vuu-ui/vuu-utils": "0.13.113",
28-
"@vuu-ui/vuu-table": "0.13.113",
20+
"@vuu-ui/vuu-context-menu": "0.13.114",
21+
"@vuu-ui/vuu-data-remote": "0.13.114",
22+
"@vuu-ui/vuu-filter-parser": "0.13.114",
23+
"@vuu-ui/vuu-filters": "0.13.114",
24+
"@vuu-ui/vuu-layout": "0.13.114",
25+
"@vuu-ui/vuu-notifications": "0.13.114",
26+
"@vuu-ui/vuu-ui-controls": "0.13.114",
27+
"@vuu-ui/vuu-utils": "0.13.114",
28+
"@vuu-ui/vuu-table": "0.13.114",
2929
"@salt-ds/core": "1.54.1",
3030
"@salt-ds/styles": "0.2.1",
3131
"@salt-ds/window": "0.1.1"

vuu-ui/packages/vuu-data-react/src/hooks/useSessionDataSource.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ export const useSessionDataSource = (props?: SessionStateHookProps) => {
2525
) => {
2626
let ds = sessionState.get(sessionKey);
2727
if (ds) {
28-
if (ds.range.from > 0) {
29-
// UI does not currently restore scroll position, so always reset to top of dataset
30-
ds.range = ds.range.reset;
31-
}
3228
return ds;
3329
}
3430

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vuu-ui/vuu-data-remote",
3-
"version": "0.13.113",
3+
"version": "0.13.114",
44
"main": "src/index.ts",
55
"author": "heswell",
66
"license": "Apache-2.0",
@@ -12,13 +12,13 @@
1212
"type-defs": "node ../../scripts/build-type-defs.mjs"
1313
},
1414
"devDependencies": {
15-
"@vuu-ui/vuu-data-types": "0.13.113",
16-
"@vuu-ui/vuu-table-types": "0.13.113",
17-
"@vuu-ui/vuu-filter-types": "0.13.113",
18-
"@vuu-ui/vuu-protocol-types": "0.13.113"
15+
"@vuu-ui/vuu-data-types": "0.13.114",
16+
"@vuu-ui/vuu-table-types": "0.13.114",
17+
"@vuu-ui/vuu-filter-types": "0.13.114",
18+
"@vuu-ui/vuu-protocol-types": "0.13.114"
1919
},
2020
"dependencies": {
21-
"@vuu-ui/vuu-filter-parser": "0.13.113",
22-
"@vuu-ui/vuu-utils": "0.13.113"
21+
"@vuu-ui/vuu-filter-parser": "0.13.114",
22+
"@vuu-ui/vuu-utils": "0.13.114"
2323
}
2424
}

vuu-ui/packages/vuu-data-remote/src/ConnectionManager.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,16 @@ class ConnectionManager extends EventEmitter<ConnectionEvents> {
108108
}
109109
}
110110

111+
disableActiveSubscriptions() {
112+
console.log(`[ConnectionManager] disableActiveSubscriptions`);
113+
this.#worker.send({ type: "disable-all-active" });
114+
}
115+
116+
enableActiveSubscriptions() {
117+
console.log(`[ConnectionManager] enableActiveSubscriptions`);
118+
this.#worker.send({ type: "enable-all-active" });
119+
}
120+
111121
private handleMessageFromWorker = (
112122
message: VuuUIMessageIn | DataSourceCallbackMessage | ConnectionStatus,
113123
) => {

vuu-ui/packages/vuu-data-remote/src/VuuDataSource.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ export class VuuDataSource extends BaseDataSource implements DataSource {
130130
const { viewport = this.viewport || (this.viewport = uuid()) } =
131131
subscribeProps;
132132

133-
if (this.#status === "disabled" || this.#status === "disabling") {
133+
if (
134+
this.#status === "disabled" ||
135+
this.#status === "disabling" ||
136+
this.#status === "enabling"
137+
) {
134138
// We can subscribe to a disabled dataSource. No request will be
135139
// sent to server to create a new VP, just to enable the existing one.
136140
// The current subscribing client becomes the subscription owner
@@ -181,7 +185,8 @@ export class VuuDataSource extends BaseDataSource implements DataSource {
181185
} else if (message.type === "disabled") {
182186
this.#status = "disabled";
183187
} else if (message.type === "enabled") {
184-
this.#status = "enabled";
188+
this.#status = "subscribed";
189+
this.emit("enabled", this.viewport);
185190
} else if (isDataSourceConfigMessage(message)) {
186191
// This is an ACK for a CHANGE_VP message. Nothing to do here. We need
187192
// to wait for data to be returned before we can consider the change
@@ -248,6 +253,9 @@ export class VuuDataSource extends BaseDataSource implements DataSource {
248253
escalateToDisable = this._defaultSuspenseProps.escalateToDisable,
249254
escalateDelay = this._defaultSuspenseProps.escalateDelay,
250255
) {
256+
console.log(
257+
`[VuuDataSuurce] suspend, current status ${this.#status}, escalateToDisable ? ${escalateToDisable}`,
258+
);
251259
if (this.#status !== "unsubscribed") {
252260
info?.(`suspend #${this.viewport}, current status ${this.#status}`);
253261
if (this.viewport) {
@@ -264,6 +272,7 @@ export class VuuDataSource extends BaseDataSource implements DataSource {
264272
}
265273

266274
resume(callback?: DataSourceSubscribeCallback) {
275+
console.log(`[VuuDataSuurce] resume, current status ${this.#status}`);
267276
const isDisabled = this.#status.startsWith("disabl");
268277
const isSuspended = this.#status === "suspended";
269278
info?.(`resume #${this.viewport}, current status ${this.#status}`);
@@ -334,6 +343,7 @@ export class VuuDataSource extends BaseDataSource implements DataSource {
334343
viewport: this.viewport,
335344
type: "enable",
336345
});
346+
// TODO is this a bit premature ?
337347
this.emit("enabled", this.viewport);
338348
}
339349
}

0 commit comments

Comments
 (0)