@xh/hoist 74.0.0-SNAPSHOT.1748339737885 → 74.0.0-SNAPSHOT.1748340686867
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.
|
@@ -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;
|
|
@@ -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.
|
|
@@ -561,10 +546,7 @@ export class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
561
546
|
private pendingValueReaction(): ReactionSpec {
|
|
562
547
|
return {
|
|
563
548
|
track: () => this.pendingValue,
|
|
564
|
-
run: v =>
|
|
565
|
-
if (!this.preserveUnsavedChanges) return;
|
|
566
|
-
XH.sessionStorageService.set(this.pendingValueStorageKey, v);
|
|
567
|
-
}
|
|
549
|
+
run: v => XH.sessionStorageService.set(this.pendingValueStorageKey, v)
|
|
568
550
|
};
|
|
569
551
|
}
|
|
570
552
|
|
|
@@ -606,6 +588,7 @@ export class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
606
588
|
.thenAction(latest => {
|
|
607
589
|
this.setAsView(latest, pendingValue?.token == token ? pendingValue : null);
|
|
608
590
|
this.providers.forEach(it => it.pushStateToTarget());
|
|
591
|
+
this.lastPushed = Date.now();
|
|
609
592
|
})
|
|
610
593
|
.linkTo(this.selectTask);
|
|
611
594
|
}
|
|
@@ -19,13 +19,11 @@ export class ViewManagerProvider<S> extends PersistenceProvider<S> {
|
|
|
19
19
|
throwIf(!viewManagerModel, `ViewManagerProvider requires a 'viewManagerModel'.`);
|
|
20
20
|
this.viewManagerModel = viewManagerModel;
|
|
21
21
|
viewManagerModel.providers.push(this);
|
|
22
|
-
viewManagerModel.noteStatePushed();
|
|
23
22
|
}
|
|
24
23
|
|
|
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
|
//----------------
|
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.1748340686867",
|
|
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",
|