@etsoo/react 1.5.1 → 1.5.2
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/lib/app/ReactApp.js +2 -2
- package/lib/app/Utils.d.ts +6 -0
- package/lib/app/Utils.js +15 -0
- package/package.json +1 -1
- package/src/app/ReactApp.ts +2 -2
- package/src/app/Utils.ts +16 -0
package/lib/app/ReactApp.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ActionResultError, BridgeUtils, CoreApp, createClient } from '@etsoo/appscript';
|
|
2
2
|
import { WindowStorage } from '@etsoo/shared';
|
|
3
|
-
import { navigate } from '@reach/router';
|
|
4
3
|
import React from 'react';
|
|
5
4
|
import { NotifierMU } from '../mu/NotifierMU';
|
|
6
5
|
import { ProgressCount } from '../mu/ProgressCount';
|
|
@@ -8,6 +7,7 @@ import { CultureState } from '../states/CultureState';
|
|
|
8
7
|
import { PageActionType, PageState } from '../states/PageState';
|
|
9
8
|
import { UserActionType, UserState } from '../states/UserState';
|
|
10
9
|
import { Labels } from './Labels';
|
|
10
|
+
import { Utils } from './Utils';
|
|
11
11
|
/**
|
|
12
12
|
* Global application
|
|
13
13
|
*/
|
|
@@ -194,7 +194,7 @@ export class ReactApp extends CoreApp {
|
|
|
194
194
|
* @param url Url
|
|
195
195
|
*/
|
|
196
196
|
redirectTo(url) {
|
|
197
|
-
navigate(url);
|
|
197
|
+
Utils.getMemoryHistory().navigate(url);
|
|
198
198
|
}
|
|
199
199
|
/**
|
|
200
200
|
* Set page data
|
package/lib/app/Utils.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { History } from '@reach/router';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
/**
|
|
3
4
|
* React utils
|
|
@@ -9,6 +10,11 @@ export declare namespace Utils {
|
|
|
9
10
|
* @returns Formatted value
|
|
10
11
|
*/
|
|
11
12
|
function formatInputValue(value: unknown): string | number | any[] | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* Get memory history
|
|
15
|
+
* @returns History
|
|
16
|
+
*/
|
|
17
|
+
function getMemoryHistory(): History;
|
|
12
18
|
/**
|
|
13
19
|
* Is safe click
|
|
14
20
|
* @param event Mouse event
|
package/lib/app/Utils.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { createHistory, createMemorySource } from '@reach/router';
|
|
1
2
|
/**
|
|
2
3
|
* React utils
|
|
3
4
|
*/
|
|
4
5
|
export var Utils;
|
|
5
6
|
(function (Utils) {
|
|
7
|
+
// Memory history
|
|
8
|
+
// https://github.com/reach/router/issues/225
|
|
9
|
+
let memoryHistory;
|
|
6
10
|
/**
|
|
7
11
|
* Format input value
|
|
8
12
|
* @param value Input value
|
|
@@ -20,6 +24,17 @@ export var Utils;
|
|
|
20
24
|
return String(value);
|
|
21
25
|
}
|
|
22
26
|
Utils.formatInputValue = formatInputValue;
|
|
27
|
+
/**
|
|
28
|
+
* Get memory history
|
|
29
|
+
* @returns History
|
|
30
|
+
*/
|
|
31
|
+
function getMemoryHistory() {
|
|
32
|
+
if (memoryHistory == null) {
|
|
33
|
+
memoryHistory = createHistory(createMemorySource('/'));
|
|
34
|
+
}
|
|
35
|
+
return memoryHistory;
|
|
36
|
+
}
|
|
37
|
+
Utils.getMemoryHistory = getMemoryHistory;
|
|
23
38
|
/**
|
|
24
39
|
* Is safe click
|
|
25
40
|
* @param event Mouse event
|
package/package.json
CHANGED
package/src/app/ReactApp.ts
CHANGED
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
NotificationReturn
|
|
15
15
|
} from '@etsoo/notificationbase';
|
|
16
16
|
import { DataTypes, WindowStorage } from '@etsoo/shared';
|
|
17
|
-
import { navigate } from '@reach/router';
|
|
18
17
|
import React from 'react';
|
|
19
18
|
import { NotifierMU } from '../mu/NotifierMU';
|
|
20
19
|
import { ProgressCount } from '../mu/ProgressCount';
|
|
@@ -35,6 +34,7 @@ import {
|
|
|
35
34
|
} from '../states/UserState';
|
|
36
35
|
import { InputDialogProps } from './InputDialogProps';
|
|
37
36
|
import { Labels } from './Labels';
|
|
37
|
+
import { Utils } from './Utils';
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Global application
|
|
@@ -355,7 +355,7 @@ export class ReactApp<
|
|
|
355
355
|
* @param url Url
|
|
356
356
|
*/
|
|
357
357
|
override redirectTo(url: string) {
|
|
358
|
-
navigate(url);
|
|
358
|
+
Utils.getMemoryHistory().navigate(url);
|
|
359
359
|
}
|
|
360
360
|
|
|
361
361
|
/**
|
package/src/app/Utils.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import { createHistory, createMemorySource, History } from '@reach/router';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* React utils
|
|
5
6
|
*/
|
|
6
7
|
export namespace Utils {
|
|
8
|
+
// Memory history
|
|
9
|
+
// https://github.com/reach/router/issues/225
|
|
10
|
+
let memoryHistory: History | null;
|
|
11
|
+
|
|
7
12
|
/**
|
|
8
13
|
* Format input value
|
|
9
14
|
* @param value Input value
|
|
@@ -21,6 +26,17 @@ export namespace Utils {
|
|
|
21
26
|
return String(value);
|
|
22
27
|
}
|
|
23
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Get memory history
|
|
31
|
+
* @returns History
|
|
32
|
+
*/
|
|
33
|
+
export function getMemoryHistory() {
|
|
34
|
+
if (memoryHistory == null) {
|
|
35
|
+
memoryHistory = createHistory(createMemorySource('/'));
|
|
36
|
+
}
|
|
37
|
+
return memoryHistory;
|
|
38
|
+
}
|
|
39
|
+
|
|
24
40
|
/**
|
|
25
41
|
* Is safe click
|
|
26
42
|
* @param event Mouse event
|