@xh/hoist 62.0.0 → 62.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
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 62.0.1 - 2024-03-28
4
+
5
+ ### 🐞 New Features
6
+ * New method `clear()` added to `TaskObserver` api.
7
+
8
+ ### 🐞 Bug Fixes
9
+
10
+ * Ensure application viewport is masked throughout the entire app initialization process.
11
+
3
12
  ## 62.0.0 - 2024-03-19
4
13
 
5
14
  ### 💥 Breaking Changes (upgrade difficulty: 🟢 TRIVIAL - dependencies only)
@@ -118,6 +118,8 @@ export class AppContainerModel extends HoistModel {
118
118
  * Triggers initial authentication and initialization of Hoist and application.
119
119
  */
120
120
  async initAsync() {
121
+ this.setAppState('PRE_AUTH');
122
+
121
123
  // Avoid bug where "Discarded" browser tabs can re-init an old version (see #3574)
122
124
  if (window.document['wasDiscarded']) {
123
125
  XH.reloadApp();
@@ -151,7 +153,6 @@ export class AppContainerModel extends HoistModel {
151
153
 
152
154
  try {
153
155
  await installServicesAsync(FetchService);
154
- this.setAppState('PRE_AUTH');
155
156
 
156
157
  // consult (optional) pre-auth init for app
157
158
  const modelClass: any = this.appSpec.modelClass;
@@ -45,6 +45,7 @@ export class AppStateModel extends HoistModel {
45
45
  this.setAppState('SUSPENDED');
46
46
  XH.webSocketService.shutdown();
47
47
  Timer.cancelAll();
48
+ XH.appContainerModel.appLoadModel.clear();
48
49
  }
49
50
 
50
51
  checkAccess(): boolean {
@@ -90,6 +90,11 @@ export class TaskObserver {
90
90
  */
91
91
  linkTo(task: TaskObserver) {}
92
92
 
93
+ /**
94
+ * Clear any tasks currently being observed.
95
+ */
96
+ clear() {}
97
+
93
98
  /**
94
99
  * This class is abstract and should not be instantiated directly. To get an instance of this
95
100
  * class, use static methods trackFirst(), trackLast() or fromPromise().
@@ -155,6 +160,11 @@ class CompoundObserver extends TaskObserver {
155
160
  this._subtasks = keep;
156
161
  }
157
162
  }
163
+
164
+ @action
165
+ override clear() {
166
+ this._subtasks = [];
167
+ }
158
168
  }
159
169
 
160
170
  class PromiseObserver extends TaskObserver {
@@ -177,6 +187,11 @@ class PromiseObserver extends TaskObserver {
177
187
  return this._message;
178
188
  }
179
189
 
190
+ @action
191
+ override clear() {
192
+ this._isPending = false;
193
+ }
194
+
180
195
  constructor(promise, message) {
181
196
  super();
182
197
  makeObservable(this);
@@ -107,7 +107,7 @@ function viewForState() {
107
107
  switch (XH.appState) {
108
108
  case 'PRE_AUTH':
109
109
  case 'INITIALIZING':
110
- return viewport(appLoadMask());
110
+ return viewport(mask({spinner: true, isDisplayed: true}));
111
111
  case 'LOGIN_REQUIRED':
112
112
  return loginPanel();
113
113
  case 'ACCESS_DENIED':
@@ -170,11 +170,15 @@ const appLoadMask = hoistCmp.factory<AppContainerModel>(({model}) =>
170
170
 
171
171
  const suspendedView = hoistCmp.factory<AppContainerModel>({
172
172
  render({model}) {
173
+ let ret;
173
174
  if (model.appStateModel.suspendData?.reason === 'IDLE') {
174
175
  const content = model.appSpec.idlePanel ?? idlePanel;
175
- return elementFromContent(content, {onReactivate: () => XH.reloadApp()});
176
+ ret = elementFromContent(content, {onReactivate: () => XH.reloadApp()});
177
+ } else {
178
+ ret = suspendPanel();
176
179
  }
177
- return suspendPanel();
180
+
181
+ return viewport(ret, appLoadMask());
178
182
  }
179
183
  });
180
184
 
@@ -11,13 +11,14 @@ import {createElement, hoistCmp, refreshContextView, uses, XH} from '@xh/hoist/c
11
11
  import {installMobileImpls} from '@xh/hoist/dynamics/mobile';
12
12
  import {colChooser} from '@xh/hoist/mobile/cmp/grid/impl/ColChooser';
13
13
  import {ColChooserModel} from '@xh/hoist/mobile/cmp/grid/impl/ColChooserModel';
14
- import {zoneMapper} from '@xh/hoist/mobile/cmp/zoneGrid/impl/ZoneMapper';
15
14
  import {mask} from '@xh/hoist/mobile/cmp/mask';
15
+ import {pinPadImpl} from '@xh/hoist/mobile/cmp/pinpad/impl/PinPad';
16
16
  import {storeFilterFieldImpl} from '@xh/hoist/mobile/cmp/store/impl/StoreFilterField';
17
17
  import {tabContainerImpl} from '@xh/hoist/mobile/cmp/tab/impl/TabContainer';
18
- import {pinPadImpl} from '@xh/hoist/mobile/cmp/pinpad/impl/PinPad';
19
- import {useOnMount, elementFromContent} from '@xh/hoist/utils/react';
18
+ import {zoneMapper} from '@xh/hoist/mobile/cmp/zoneGrid/impl/ZoneMapper';
19
+ import {elementFromContent, useOnMount} from '@xh/hoist/utils/react';
20
20
  import {isEmpty} from 'lodash';
21
+ import {errorMessage} from '../cmp/error/ErrorMessage';
21
22
  import {aboutDialog} from './AboutDialog';
22
23
  import {banner} from './Banner';
23
24
  import {exceptionDialog} from './ExceptionDialog';
@@ -26,12 +27,11 @@ import {idlePanel} from './IdlePanel';
26
27
  import {impersonationBar} from './ImpersonationBar';
27
28
  import {lockoutPanel} from './LockoutPanel';
28
29
  import {loginPanel} from './LoginPanel';
29
- import {suspendPanel} from './SuspendPanel';
30
30
  import {messageSource} from './MessageSource';
31
31
  import {optionsDialog} from './OptionsDialog';
32
+ import {suspendPanel} from './SuspendPanel';
32
33
  import {toastSource} from './ToastSource';
33
34
  import {versionBar} from './VersionBar';
34
- import {errorMessage} from '../cmp/error/ErrorMessage';
35
35
 
36
36
  installMobileImpls({
37
37
  tabContainerImpl,
@@ -90,7 +90,7 @@ function viewForState() {
90
90
  switch (XH.appState) {
91
91
  case 'PRE_AUTH':
92
92
  case 'INITIALIZING':
93
- return viewport(appLoadMask());
93
+ return viewport(mask({spinner: true, isDisplayed: true}));
94
94
  case 'LOGIN_REQUIRED':
95
95
  return loginPanel();
96
96
  case 'ACCESS_DENIED':
@@ -153,10 +153,14 @@ const bannerList = hoistCmp.factory<AppContainerModel>({
153
153
 
154
154
  const suspendedView = hoistCmp.factory<AppContainerModel>({
155
155
  render({model}) {
156
+ let ret;
156
157
  if (model.appStateModel.suspendData?.reason === 'IDLE') {
157
158
  const content = model.appSpec.idlePanel ?? idlePanel;
158
- return elementFromContent(content, {onReactivate: () => XH.reloadApp()});
159
+ ret = elementFromContent(content, {onReactivate: () => XH.reloadApp()});
160
+ } else {
161
+ ret = suspendPanel();
159
162
  }
160
- return suspendPanel();
163
+
164
+ return viewport(ret, appLoadMask());
161
165
  }
162
166
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xh/hoist",
3
- "version": "62.0.0",
3
+ "version": "62.0.1",
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",