@etsoo/react 1.5.45 → 1.5.46

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/mu/RLink.js CHANGED
@@ -10,12 +10,10 @@ import { useDelayedExecutor } from '../uses/useDelayedExecutor';
10
10
  export const RLink = React.forwardRef((props, ref) => {
11
11
  // Destruct
12
12
  const { delay = 0, href, target, onClick, ...rest } = props;
13
- const delayed = delay > 0
14
- ? useDelayedExecutor((href) => {
15
- // Router push
16
- globalApp.history.push(href);
17
- }, delay)
18
- : null;
13
+ const delayed = useDelayedExecutor((href) => {
14
+ // Router push
15
+ globalApp.history.push(href);
16
+ }, delay);
19
17
  // Click handler
20
18
  const onClickLocl = (event) => {
21
19
  if (onClick)
@@ -26,14 +24,13 @@ export const RLink = React.forwardRef((props, ref) => {
26
24
  globalApp) {
27
25
  // Prevent href action
28
26
  event.preventDefault();
29
- if (delayed != null)
30
- delayed.call(undefined, href);
31
- else
32
- globalApp.history.push(href);
27
+ // Delayed excution
28
+ delayed.call(undefined, href);
33
29
  }
34
30
  };
31
+ // Clear when exit
35
32
  React.useEffect(() => {
36
- return () => delayed === null || delayed === void 0 ? void 0 : delayed.clear();
33
+ return () => delayed.clear();
37
34
  }, [delayed]);
38
35
  // Component
39
36
  return (React.createElement(Link, { ...rest, onClick: onClickLocl, href: href, target: target, ref: ref }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.5.45",
3
+ "version": "1.5.46",
4
4
  "description": "TypeScript ReactJs framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/mu/RLink.tsx CHANGED
@@ -20,13 +20,10 @@ export const RLink = React.forwardRef<HTMLAnchorElement, RLinkProps>(
20
20
  // Destruct
21
21
  const { delay = 0, href, target, onClick, ...rest } = props;
22
22
 
23
- const delayed =
24
- delay > 0
25
- ? useDelayedExecutor((href: string) => {
26
- // Router push
27
- globalApp.history.push(href);
28
- }, delay)
29
- : null;
23
+ const delayed = useDelayedExecutor((href: string) => {
24
+ // Router push
25
+ globalApp.history.push(href);
26
+ }, delay);
30
27
 
31
28
  // Click handler
32
29
  const onClickLocl = (
@@ -43,13 +40,14 @@ export const RLink = React.forwardRef<HTMLAnchorElement, RLinkProps>(
43
40
  // Prevent href action
44
41
  event.preventDefault();
45
42
 
46
- if (delayed != null) delayed.call(undefined, href);
47
- else globalApp.history.push(href);
43
+ // Delayed excution
44
+ delayed.call(undefined, href);
48
45
  }
49
46
  };
50
47
 
48
+ // Clear when exit
51
49
  React.useEffect(() => {
52
- return () => delayed?.clear();
50
+ return () => delayed.clear();
53
51
  }, [delayed]);
54
52
 
55
53
  // Component