@xh/hoist 74.0.0-SNAPSHOT.1748449301934 → 74.0.0-SNAPSHOT.1748449592533
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 +0 -7
- package/build/types/cmp/viewmanager/ViewManagerModel.d.ts +0 -7
- package/build/types/core/persist/provider/ViewManagerProvider.d.ts +1 -3
- package/cmp/viewmanager/ViewManagerModel.ts +3 -17
- package/core/persist/provider/ViewManagerProvider.ts +0 -7
- package/package.json +1 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
## 74.0.0-SNAPSHOT - unreleased
|
|
4
4
|
|
|
5
|
-
### 🎁 New Features
|
|
6
|
-
+ Add `ViewManagerModel.preserveUnsavedChanges` flag to opt-out of that behaviour.
|
|
7
|
-
|
|
8
|
-
### 🐞 Bug Fixes
|
|
9
|
-
+ Improves `ViewManagerModel.settleTime` by comparing to when the view is pushed to components
|
|
10
|
-
rather than when view is loaded from the server.
|
|
11
|
-
|
|
12
5
|
## v73.0.1 - 2025-05-19
|
|
13
6
|
|
|
14
7
|
### 🐞 Bug Fixes
|
|
@@ -43,11 +43,6 @@ export interface ViewManagerConfig {
|
|
|
43
43
|
* True (default) to allow users to share their views with other users.
|
|
44
44
|
*/
|
|
45
45
|
enableSharing?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* True (default) to save pending state to SessionStorage so that it can be restored across
|
|
48
|
-
* browser refreshes. Unlike auto-save, this does not write to the database.
|
|
49
|
-
*/
|
|
50
|
-
preserveUnsavedChanges?: boolean;
|
|
51
46
|
/**
|
|
52
47
|
* Function to determine the initial view for a user, when no view has already been persisted.
|
|
53
48
|
* Will be passed a list of views available to the current user. Implementations where
|
|
@@ -137,7 +132,6 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
137
132
|
readonly enableDefault: boolean;
|
|
138
133
|
readonly enableGlobal: boolean;
|
|
139
134
|
readonly enableSharing: boolean;
|
|
140
|
-
readonly preserveUnsavedChanges: boolean;
|
|
141
135
|
readonly manageGlobal: boolean;
|
|
142
136
|
readonly settleTime: number;
|
|
143
137
|
readonly initialViewSpec: (views: ViewInfo[]) => ViewInfo;
|
|
@@ -204,7 +198,6 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
204
198
|
resetAsync(): Promise<void>;
|
|
205
199
|
getValue(): Partial<T>;
|
|
206
200
|
setValue(value: Partial<T>): void;
|
|
207
|
-
noteStatePushed(): void;
|
|
208
201
|
userPin(view: ViewInfo): void;
|
|
209
202
|
userUnpin(view: ViewInfo): void;
|
|
210
203
|
isUserPinned(view: ViewInfo): boolean | null;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { Persistable } from '@xh/hoist/core';
|
|
2
1
|
import { PersistenceProvider, PersistenceProviderConfig } from '../PersistenceProvider';
|
|
3
2
|
import type { ViewManagerModel } from '@xh/hoist/cmp/viewmanager/ViewManagerModel';
|
|
4
3
|
export declare class ViewManagerProvider<S> extends PersistenceProvider<S> {
|
|
5
4
|
readonly viewManagerModel: ViewManagerModel;
|
|
6
5
|
constructor(cfg: PersistenceProviderConfig<S>);
|
|
7
6
|
pushStateToTarget(): void;
|
|
8
|
-
|
|
9
|
-
readRaw(): Partial<import("@xh/hoist/core").PlainObject>;
|
|
7
|
+
readRaw(): Partial<import("../..").PlainObject>;
|
|
10
8
|
writeRaw(data: Record<typeof this.path, S>): void;
|
|
11
9
|
destroy(): void;
|
|
12
10
|
}
|
|
@@ -74,12 +74,6 @@ export interface ViewManagerConfig {
|
|
|
74
74
|
*/
|
|
75
75
|
enableSharing?: boolean;
|
|
76
76
|
|
|
77
|
-
/**
|
|
78
|
-
* True (default) to save pending state to SessionStorage so that it can be restored across
|
|
79
|
-
* browser refreshes. Unlike auto-save, this does not write to the database.
|
|
80
|
-
*/
|
|
81
|
-
preserveUnsavedChanges?: boolean;
|
|
82
|
-
|
|
83
77
|
/**
|
|
84
78
|
* Function to determine the initial view for a user, when no view has already been persisted.
|
|
85
79
|
* Will be passed a list of views available to the current user. Implementations where
|
|
@@ -182,7 +176,6 @@ export class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
182
176
|
readonly enableDefault: boolean;
|
|
183
177
|
readonly enableGlobal: boolean;
|
|
184
178
|
readonly enableSharing: boolean;
|
|
185
|
-
readonly preserveUnsavedChanges: boolean;
|
|
186
179
|
readonly manageGlobal: boolean;
|
|
187
180
|
readonly settleTime: number;
|
|
188
181
|
readonly initialViewSpec: (views: ViewInfo[]) => ViewInfo;
|
|
@@ -303,7 +296,6 @@ export class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
303
296
|
enableDefault = true,
|
|
304
297
|
enableGlobal = true,
|
|
305
298
|
enableSharing = true,
|
|
306
|
-
preserveUnsavedChanges = true,
|
|
307
299
|
settleTime = 1000,
|
|
308
300
|
initialViewSpec = null
|
|
309
301
|
}: ViewManagerConfig) {
|
|
@@ -325,7 +317,6 @@ export class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
325
317
|
this.enableGlobal = enableGlobal;
|
|
326
318
|
this.enableSharing = enableSharing;
|
|
327
319
|
this.enableAutoSave = enableAutoSave;
|
|
328
|
-
this.preserveUnsavedChanges = preserveUnsavedChanges;
|
|
329
320
|
this.settleTime = settleTime;
|
|
330
321
|
this.initialViewSpec = initialViewSpec;
|
|
331
322
|
|
|
@@ -447,10 +438,6 @@ export class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
447
438
|
}
|
|
448
439
|
}
|
|
449
440
|
|
|
450
|
-
noteStatePushed() {
|
|
451
|
-
this.lastPushed = Date.now();
|
|
452
|
-
}
|
|
453
|
-
|
|
454
441
|
//------------------
|
|
455
442
|
// Pinning
|
|
456
443
|
//------------------
|
|
@@ -528,9 +515,7 @@ export class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
528
515
|
this.views = views;
|
|
529
516
|
this.userPinned = state.userPinned;
|
|
530
517
|
this.autoSave = state.autoSave;
|
|
531
|
-
|
|
532
|
-
this.pendingValue = XH.sessionStorageService.get(pendingValueStorageKey);
|
|
533
|
-
}
|
|
518
|
+
this.pendingValue = XH.sessionStorageService.get(pendingValueStorageKey);
|
|
534
519
|
});
|
|
535
520
|
|
|
536
521
|
// 2) Initialize/choose initial view. Null is ok, and will yield default.
|
|
@@ -552,7 +537,7 @@ export class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
552
537
|
}
|
|
553
538
|
|
|
554
539
|
this.addReaction(
|
|
555
|
-
this.
|
|
540
|
+
this.pendingValueReaction(),
|
|
556
541
|
this.autoSaveReaction(),
|
|
557
542
|
...this.stateReactions(initialState)
|
|
558
543
|
);
|
|
@@ -603,6 +588,7 @@ export class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
603
588
|
.thenAction(latest => {
|
|
604
589
|
this.setAsView(latest, pendingValue?.token == token ? pendingValue : null);
|
|
605
590
|
this.providers.forEach(it => it.pushStateToTarget());
|
|
591
|
+
this.lastPushed = Date.now();
|
|
606
592
|
})
|
|
607
593
|
.linkTo(this.selectTask);
|
|
608
594
|
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* Copyright © 2025 Extremely Heavy Industries Inc.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {Persistable} from '@xh/hoist/core';
|
|
9
8
|
import {throwIf} from '@xh/hoist/utils/js';
|
|
10
9
|
import {pull} from 'lodash';
|
|
11
10
|
import {PersistenceProvider, PersistenceProviderConfig} from '../PersistenceProvider';
|
|
@@ -25,17 +24,11 @@ export class ViewManagerProvider<S> extends PersistenceProvider<S> {
|
|
|
25
24
|
pushStateToTarget() {
|
|
26
25
|
const state = this.read();
|
|
27
26
|
this.target.setPersistableState(state ? state : this.defaultState);
|
|
28
|
-
this.viewManagerModel.noteStatePushed();
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
//----------------
|
|
32
30
|
// Implementation
|
|
33
31
|
//----------------
|
|
34
|
-
override bindToTarget(target: Persistable<S>) {
|
|
35
|
-
super.bindToTarget(target);
|
|
36
|
-
this.viewManagerModel.noteStatePushed();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
32
|
override readRaw() {
|
|
40
33
|
return this.viewManagerModel.getValue();
|
|
41
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "74.0.0-SNAPSHOT.
|
|
3
|
+
"version": "74.0.0-SNAPSHOT.1748449592533",
|
|
4
4
|
"description": "Hoist add-on for building and deploying React Applications.",
|
|
5
5
|
"repository": "github:xh/hoist-react",
|
|
6
6
|
"homepage": "https://xh.io",
|