@xh/hoist 76.0.0-SNAPSHOT.1755706915375 → 76.0.0-SNAPSHOT.1755780982882
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 +5 -0
- package/build/types/core/HoistAppModel.d.ts +5 -2
- package/build/types/core/XH.d.ts +4 -2
- package/build/types/svc/PrefService.d.ts +0 -5
- package/core/HoistAppModel.ts +9 -3
- package/core/XH.ts +14 -4
- package/package.json +1 -1
- package/svc/PrefService.ts +0 -12
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
## 76.0.0-SNAPSHOT - unreleased
|
|
4
4
|
|
|
5
|
+
### 💥 Breaking Changes (upgrade difficulty: 🟢 LOW - requires hoist-core v31.2)
|
|
6
|
+
|
|
5
7
|
### 🎁 New Features
|
|
6
8
|
|
|
7
9
|
* Added new `extraConfirmText`, `extraConfirmLabel` properties to `MessageOptions`. Use this option
|
|
@@ -15,6 +17,9 @@
|
|
|
15
17
|
* Handled an edge-case `ViewManager` bug where `enableDefault` changed to `false` after some user
|
|
16
18
|
state had already been persisted w/users pointed at in-code default view. The manager now calls
|
|
17
19
|
its configured `initialViewSpec` function as expected in this case.
|
|
20
|
+
|
|
21
|
+
* `XH.restoreDefaultsAsync` will now clear basic view state. Views themselves will be preserved.
|
|
22
|
+
Requires hoist-core v31.2
|
|
18
23
|
|
|
19
24
|
### ⚙️ Technical
|
|
20
25
|
|
|
@@ -51,12 +51,15 @@ export declare class HoistAppModel extends HoistModel {
|
|
|
51
51
|
/**
|
|
52
52
|
* Resets user preferences and any persistent local application state.
|
|
53
53
|
*
|
|
54
|
-
* The default implementation for this method will clear
|
|
54
|
+
* The default implementation for this method will clear all preferences, local storage, and
|
|
55
|
+
* transient view state such as current, and pinned views. Views themselves are preserved.
|
|
55
56
|
*
|
|
56
|
-
* Applications may wish to override this method to
|
|
57
|
+
* Applications may wish to override this method to perform a more targeted clearing of state.
|
|
57
58
|
* This is important for complex applications with smaller sub-applications, and/or device
|
|
58
59
|
* specific applications. These applications will typically want to perform a custom clearing
|
|
59
60
|
* that is more targeted, and includes any additional app-specific state.
|
|
61
|
+
*
|
|
62
|
+
* Not typically called directly by applications. Call XH.restoreDefaultsAsync() instead.
|
|
60
63
|
*/
|
|
61
64
|
restoreDefaultsAsync(): Promise<void>;
|
|
62
65
|
}
|
package/build/types/core/XH.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { ToastModel } from '../appcontainer/ToastModel';
|
|
|
11
11
|
import '../styles/XH.scss';
|
|
12
12
|
import { AppSpec, AppState, AppSuspendData, BannerSpec, ExceptionHandler, ExceptionHandlerOptions, HoistAppModel, HoistException, HoistService, HoistServiceClass, HoistUser, MessageSpec, PageState, PlainObject, ReloadAppOptions, SizingMode, TaskObserver, Theme, ToastSpec, TrackOptions } from './';
|
|
13
13
|
import { HoistModel, ModelSelector, RefreshContextModel } from './model';
|
|
14
|
-
export declare const MIN_HOIST_CORE_VERSION = "
|
|
14
|
+
export declare const MIN_HOIST_CORE_VERSION = "31.2";
|
|
15
15
|
/**
|
|
16
16
|
* Top-level Singleton model for Hoist. This is the main entry point for the API.
|
|
17
17
|
*
|
|
@@ -396,7 +396,9 @@ export declare class XHApi {
|
|
|
396
396
|
/** All Stores registered with this application. */
|
|
397
397
|
getStores(): Store[];
|
|
398
398
|
/**
|
|
399
|
-
* Reset user
|
|
399
|
+
* Reset user state and then reload the app.
|
|
400
|
+
*
|
|
401
|
+
* @see HoistAppModel.restoreDefaultsAsync()
|
|
400
402
|
*/
|
|
401
403
|
restoreDefaultsAsync(): Promise<void>;
|
|
402
404
|
/**
|
|
@@ -56,11 +56,6 @@ export declare class PrefService extends HoistService {
|
|
|
56
56
|
* before making another call that relies on its updated value being read on the server.
|
|
57
57
|
*/
|
|
58
58
|
pushAsync(key: string, value: any): Promise<void>;
|
|
59
|
-
/**
|
|
60
|
-
* Reset *all* preferences, reverting their effective values back to defaults.
|
|
61
|
-
* @returns a Promise that resolves when preferences have been cleared and defaults reloaded.
|
|
62
|
-
*/
|
|
63
|
-
clearAllAsync(): Promise<void>;
|
|
64
59
|
/**
|
|
65
60
|
* Push any pending buffered updates to persist newly set values to server.
|
|
66
61
|
* Called automatically by this app on page unload to avoid dropping changes when e.g. a user
|
package/core/HoistAppModel.ts
CHANGED
|
@@ -88,16 +88,22 @@ export class HoistAppModel extends HoistModel {
|
|
|
88
88
|
/**
|
|
89
89
|
* Resets user preferences and any persistent local application state.
|
|
90
90
|
*
|
|
91
|
-
* The default implementation for this method will clear
|
|
91
|
+
* The default implementation for this method will clear all preferences, local storage, and
|
|
92
|
+
* transient view state such as current, and pinned views. Views themselves are preserved.
|
|
92
93
|
*
|
|
93
|
-
* Applications may wish to override this method to
|
|
94
|
+
* Applications may wish to override this method to perform a more targeted clearing of state.
|
|
94
95
|
* This is important for complex applications with smaller sub-applications, and/or device
|
|
95
96
|
* specific applications. These applications will typically want to perform a custom clearing
|
|
96
97
|
* that is more targeted, and includes any additional app-specific state.
|
|
98
|
+
*
|
|
99
|
+
* Not typically called directly by applications. Call XH.restoreDefaultsAsync() instead.
|
|
97
100
|
*/
|
|
98
101
|
async restoreDefaultsAsync() {
|
|
99
102
|
const XH = window['XH'];
|
|
100
|
-
await XH.
|
|
103
|
+
await XH.fetchJson({
|
|
104
|
+
url: 'xh/clearUserState',
|
|
105
|
+
params: {clientUsername: XH.getUsername()}
|
|
106
|
+
});
|
|
101
107
|
XH.localStorageService.clear();
|
|
102
108
|
XH.sessionStorageService.clear();
|
|
103
109
|
}
|
package/core/XH.ts
CHANGED
|
@@ -67,7 +67,7 @@ import {instanceManager} from './impl/InstanceManager';
|
|
|
67
67
|
import {HoistModel, ModelSelector, RefreshContextModel} from './model';
|
|
68
68
|
import ShortUniqueId from 'short-unique-id';
|
|
69
69
|
|
|
70
|
-
export const MIN_HOIST_CORE_VERSION = '
|
|
70
|
+
export const MIN_HOIST_CORE_VERSION = '31.2';
|
|
71
71
|
|
|
72
72
|
declare const xhAppCode: string;
|
|
73
73
|
declare const xhAppName: string;
|
|
@@ -772,11 +772,21 @@ export class XHApi {
|
|
|
772
772
|
}
|
|
773
773
|
|
|
774
774
|
/**
|
|
775
|
-
* Reset user
|
|
775
|
+
* Reset user state and then reload the app.
|
|
776
|
+
*
|
|
777
|
+
* @see HoistAppModel.restoreDefaultsAsync()
|
|
776
778
|
*/
|
|
777
779
|
async restoreDefaultsAsync() {
|
|
778
|
-
|
|
779
|
-
|
|
780
|
+
try {
|
|
781
|
+
await this.appModel.restoreDefaultsAsync();
|
|
782
|
+
XH.trackService.track({category: 'App', message: 'Restored app defaults'});
|
|
783
|
+
this.reloadApp();
|
|
784
|
+
} catch (e) {
|
|
785
|
+
XH.handleException(e, {
|
|
786
|
+
message: 'Failed to restore app defaults',
|
|
787
|
+
requireReload: true
|
|
788
|
+
});
|
|
789
|
+
}
|
|
780
790
|
}
|
|
781
791
|
|
|
782
792
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xh/hoist",
|
|
3
|
-
"version": "76.0.0-SNAPSHOT.
|
|
3
|
+
"version": "76.0.0-SNAPSHOT.1755780982882",
|
|
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",
|
package/svc/PrefService.ts
CHANGED
|
@@ -110,18 +110,6 @@ export class PrefService extends HoistService {
|
|
|
110
110
|
return this.pushPendingAsync();
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
/**
|
|
114
|
-
* Reset *all* preferences, reverting their effective values back to defaults.
|
|
115
|
-
* @returns a Promise that resolves when preferences have been cleared and defaults reloaded.
|
|
116
|
-
*/
|
|
117
|
-
async clearAllAsync() {
|
|
118
|
-
await XH.fetchJson({
|
|
119
|
-
url: 'xh/clearPrefs',
|
|
120
|
-
params: {clientUsername: XH.getUsername()}
|
|
121
|
-
});
|
|
122
|
-
return this.loadPrefsAsync();
|
|
123
|
-
}
|
|
124
|
-
|
|
125
113
|
/**
|
|
126
114
|
* Push any pending buffered updates to persist newly set values to server.
|
|
127
115
|
* Called automatically by this app on page unload to avoid dropping changes when e.g. a user
|