@trackunit/react-core-contexts-test 1.3.49 → 1.3.50
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/index.cjs.js +14 -9
- package/index.esm.js +14 -9
- package/package.json +4 -4
- package/src/debugger.d.ts +5 -0
package/index.cjs.js
CHANGED
|
@@ -925,18 +925,22 @@ class TrackunitProvidersMockBuilder {
|
|
|
925
925
|
*/
|
|
926
926
|
const trackunitProviders = () => new TrackunitProvidersMockBuilder();
|
|
927
927
|
|
|
928
|
+
/**
|
|
929
|
+
* Differentiate between the first and subsequent renders.
|
|
930
|
+
*
|
|
931
|
+
* @returns {boolean} Returns true if it is the first render, false otherwise.
|
|
932
|
+
*/
|
|
928
933
|
/**
|
|
929
934
|
* Differentiate between the first and subsequent renders.
|
|
930
935
|
*
|
|
931
936
|
* @returns {boolean} Returns true if it is the first render, false otherwise.
|
|
932
937
|
*/
|
|
933
938
|
const useIsFirstRender = () => {
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
return renderRef.current;
|
|
939
|
+
const [isFirstRender, setIsFirstRender] = react.useState(true);
|
|
940
|
+
react.useEffect(() => {
|
|
941
|
+
setIsFirstRender(false);
|
|
942
|
+
}, []);
|
|
943
|
+
return isFirstRender;
|
|
940
944
|
};
|
|
941
945
|
/**
|
|
942
946
|
* Logs props that have changed.
|
|
@@ -1023,14 +1027,15 @@ const Debugger = ({ id, logPropsChanges, stop, children, }) => {
|
|
|
1023
1027
|
new Error().stack?.split("\n")[2]?.trim() ||
|
|
1024
1028
|
"unknown-id";
|
|
1025
1029
|
useDebugger(logPropsChanges || {}, id);
|
|
1030
|
+
const uniqueIdRef = react.useRef(uniqueId);
|
|
1026
1031
|
react.useEffect(() => {
|
|
1032
|
+
const currentUniqueId = uniqueIdRef.current;
|
|
1027
1033
|
// eslint-disable-next-line no-console
|
|
1028
|
-
console.log(`${
|
|
1034
|
+
console.log(`${currentUniqueId} Debugger is mounting`);
|
|
1029
1035
|
return () => {
|
|
1030
1036
|
// eslint-disable-next-line no-console
|
|
1031
|
-
console.log(`${
|
|
1037
|
+
console.log(`${currentUniqueId} Debugger is unmounting`);
|
|
1032
1038
|
};
|
|
1033
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1034
1039
|
}, []);
|
|
1035
1040
|
if (stop === true) {
|
|
1036
1041
|
// eslint-disable-next-line no-debugger
|
package/index.esm.js
CHANGED
|
@@ -923,18 +923,22 @@ class TrackunitProvidersMockBuilder {
|
|
|
923
923
|
*/
|
|
924
924
|
const trackunitProviders = () => new TrackunitProvidersMockBuilder();
|
|
925
925
|
|
|
926
|
+
/**
|
|
927
|
+
* Differentiate between the first and subsequent renders.
|
|
928
|
+
*
|
|
929
|
+
* @returns {boolean} Returns true if it is the first render, false otherwise.
|
|
930
|
+
*/
|
|
926
931
|
/**
|
|
927
932
|
* Differentiate between the first and subsequent renders.
|
|
928
933
|
*
|
|
929
934
|
* @returns {boolean} Returns true if it is the first render, false otherwise.
|
|
930
935
|
*/
|
|
931
936
|
const useIsFirstRender = () => {
|
|
932
|
-
const
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
return renderRef.current;
|
|
937
|
+
const [isFirstRender, setIsFirstRender] = useState(true);
|
|
938
|
+
useEffect(() => {
|
|
939
|
+
setIsFirstRender(false);
|
|
940
|
+
}, []);
|
|
941
|
+
return isFirstRender;
|
|
938
942
|
};
|
|
939
943
|
/**
|
|
940
944
|
* Logs props that have changed.
|
|
@@ -1021,14 +1025,15 @@ const Debugger = ({ id, logPropsChanges, stop, children, }) => {
|
|
|
1021
1025
|
new Error().stack?.split("\n")[2]?.trim() ||
|
|
1022
1026
|
"unknown-id";
|
|
1023
1027
|
useDebugger(logPropsChanges || {}, id);
|
|
1028
|
+
const uniqueIdRef = useRef(uniqueId);
|
|
1024
1029
|
useEffect(() => {
|
|
1030
|
+
const currentUniqueId = uniqueIdRef.current;
|
|
1025
1031
|
// eslint-disable-next-line no-console
|
|
1026
|
-
console.log(`${
|
|
1032
|
+
console.log(`${currentUniqueId} Debugger is mounting`);
|
|
1027
1033
|
return () => {
|
|
1028
1034
|
// eslint-disable-next-line no-console
|
|
1029
|
-
console.log(`${
|
|
1035
|
+
console.log(`${currentUniqueId} Debugger is unmounting`);
|
|
1030
1036
|
};
|
|
1031
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1032
1037
|
}, []);
|
|
1033
1038
|
if (stop === true) {
|
|
1034
1039
|
// eslint-disable-next-line no-debugger
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts-test",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.50",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"lodash": "4.17.21",
|
|
14
14
|
"graphql": "^16.10.0",
|
|
15
15
|
"@tanstack/react-router": "1.47.1",
|
|
16
|
-
"@trackunit/react-core-contexts-api": "1.4.
|
|
17
|
-
"@trackunit/react-core-hooks": "1.3.
|
|
18
|
-
"@trackunit/shared-utils": "1.5.
|
|
16
|
+
"@trackunit/react-core-contexts-api": "1.4.48",
|
|
17
|
+
"@trackunit/react-core-hooks": "1.3.50",
|
|
18
|
+
"@trackunit/shared-utils": "1.5.47"
|
|
19
19
|
},
|
|
20
20
|
"module": "./index.esm.js",
|
|
21
21
|
"main": "./index.cjs.js",
|
package/src/debugger.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
type PropsToWatch<P> = P extends object ? P : never;
|
|
3
|
+
/**
|
|
4
|
+
* Differentiate between the first and subsequent renders.
|
|
5
|
+
*
|
|
6
|
+
* @returns {boolean} Returns true if it is the first render, false otherwise.
|
|
7
|
+
*/
|
|
3
8
|
/**
|
|
4
9
|
* Differentiate between the first and subsequent renders.
|
|
5
10
|
*
|