@etsoo/react 1.5.16 → 1.5.17

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.
@@ -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';
@@ -199,7 +198,8 @@ export class ReactApp extends CoreApp {
199
198
  * @param url Url
200
199
  */
201
200
  redirectTo(url) {
202
- (this.history == null ? navigate : this.history.navigate)(url);
201
+ const navigate = ReactUtils.getNavigateFn();
202
+ navigate(url);
203
203
  }
204
204
  /**
205
205
  * Set page data
@@ -10,8 +10,6 @@ import { ReactUtils } from '../app/ReactUtils';
10
10
  export function BackButton(props) {
11
11
  // Destruct
12
12
  const { color = 'primary', size = 'small', onClick, ...rest } = props;
13
- // Navigate
14
- const navigate = ReactUtils.getNavigateFn();
15
13
  // Theme
16
14
  const theme = useTheme();
17
15
  // Color
@@ -19,10 +17,16 @@ export function BackButton(props) {
19
17
  ? theme.palette[color]
20
18
  : theme.palette.primary;
21
19
  // Click handler
22
- const onClickLocal = (event) => {
20
+ const onClickLocal = async (event) => {
23
21
  if (onClick)
24
22
  onClick(event);
25
- navigate(-1);
23
+ // Navigate
24
+ const navigate = ReactUtils.getNavigateFn();
25
+ await navigate(-1);
26
+ const history = ReactUtils.getMemoryHistory();
27
+ if (history) {
28
+ console.log(history);
29
+ }
26
30
  };
27
31
  return (React.createElement(IconButton, { "aria-label": "Back", color: color, size: size, onClick: onClickLocal, sx: {
28
32
  backgroundColor: pColor.contrastText,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.5.16",
3
+ "version": "1.5.17",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -14,7 +14,7 @@ import {
14
14
  NotificationReturn
15
15
  } from '@etsoo/notificationbase';
16
16
  import { DataTypes, WindowStorage } from '@etsoo/shared';
17
- import { History, navigate } from '@reach/router';
17
+ import { History } from '@reach/router';
18
18
  import React from 'react';
19
19
  import { NotifierMU } from '../mu/NotifierMU';
20
20
  import { ProgressCount } from '../mu/ProgressCount';
@@ -370,7 +370,8 @@ export class ReactApp<
370
370
  * @param url Url
371
371
  */
372
372
  override redirectTo(url: string) {
373
- (this.history == null ? navigate : this.history.navigate)(url);
373
+ const navigate = ReactUtils.getNavigateFn();
374
+ navigate(url);
374
375
  }
375
376
 
376
377
  /**
@@ -2,6 +2,7 @@ import { IconButton, IconButtonProps, useTheme } from '@mui/material';
2
2
  import ArrowBackIcon from '@mui/icons-material/ArrowBack';
3
3
  import React from 'react';
4
4
  import { ReactUtils } from '../app/ReactUtils';
5
+ import { BridgeUtils } from '@etsoo/appscript';
5
6
 
6
7
  /**
7
8
  * BackButton props
@@ -17,9 +18,6 @@ export function BackButton(props: BackButtonProps) {
17
18
  // Destruct
18
19
  const { color = 'primary', size = 'small', onClick, ...rest } = props;
19
20
 
20
- // Navigate
21
- const navigate = ReactUtils.getNavigateFn();
22
-
23
21
  // Theme
24
22
  const theme = useTheme();
25
23
 
@@ -30,9 +28,17 @@ export function BackButton(props: BackButtonProps) {
30
28
  : theme.palette.primary;
31
29
 
32
30
  // Click handler
33
- const onClickLocal = (event: React.MouseEvent<HTMLButtonElement>) => {
31
+ const onClickLocal = async (event: React.MouseEvent<HTMLButtonElement>) => {
34
32
  if (onClick) onClick(event);
35
- navigate(-1);
33
+
34
+ // Navigate
35
+ const navigate = ReactUtils.getNavigateFn();
36
+ await navigate(-1);
37
+
38
+ const history = ReactUtils.getMemoryHistory();
39
+ if (history) {
40
+ console.log(history);
41
+ }
36
42
  };
37
43
 
38
44
  return (