@gooddata/sdk-ui 10.43.0 → 10.44.0-alpha.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/esm/base/react/useDebugEquality.d.ts +11 -0
- package/esm/base/react/useDebugEquality.d.ts.map +1 -0
- package/esm/base/react/useDebugEquality.js +37 -0
- package/esm/base/react/useDebugEquality.js.map +1 -0
- package/esm/base/react/useDeepMemo.d.ts +8 -0
- package/esm/base/react/useDeepMemo.d.ts.map +1 -0
- package/esm/base/react/useDeepMemo.js +30 -0
- package/esm/base/react/useDeepMemo.js.map +1 -0
- package/esm/base/react/useInitialProp.d.ts +8 -0
- package/esm/base/react/useInitialProp.d.ts.map +1 -0
- package/esm/base/react/useInitialProp.js +13 -0
- package/esm/base/react/useInitialProp.js.map +1 -0
- package/esm/internal.d.ts +4 -0
- package/esm/internal.d.ts.map +1 -0
- package/esm/internal.js +5 -0
- package/esm/internal.js.map +1 -0
- package/package.json +11 -10
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* Debug hook that outputs a formatted table showing prop equality checks.
|
3
|
+
* Compares current props with previous props using both strict equality and deep equality.
|
4
|
+
* This is useful if you want to check why and when some hook with multiple dependencies was re-triggered.
|
5
|
+
*
|
6
|
+
* @param props - The props object to debug
|
7
|
+
* @param render - When to print the table: "eachRender" prints on every render, "changeOnly" prints only when equality results change
|
8
|
+
* @internal
|
9
|
+
*/
|
10
|
+
export declare const useDebugEquality: <T extends object>(props: T, render?: "eachRender" | "changeOnly") => void;
|
11
|
+
//# sourceMappingURL=useDebugEquality.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useDebugEquality.d.ts","sourceRoot":"","sources":["../../../src/base/react/useDebugEquality.ts"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,EAC7C,OAAO,CAAC,EACR,SAAQ,YAAY,GAAG,YAA2B,KACnD,IA6BF,CAAC"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
2
|
+
import isEqual from "lodash/isEqual.js";
|
3
|
+
import { usePrevious } from "@gooddata/sdk-ui";
|
4
|
+
/**
|
5
|
+
* Debug hook that outputs a formatted table showing prop equality checks.
|
6
|
+
* Compares current props with previous props using both strict equality and deep equality.
|
7
|
+
* This is useful if you want to check why and when some hook with multiple dependencies was re-triggered.
|
8
|
+
*
|
9
|
+
* @param props - The props object to debug
|
10
|
+
* @param render - When to print the table: "eachRender" prints on every render, "changeOnly" prints only when equality results change
|
11
|
+
* @internal
|
12
|
+
*/
|
13
|
+
export const useDebugEquality = (props, render = "eachRender") => {
|
14
|
+
const previousProps = usePrevious(props);
|
15
|
+
const results = Object.keys(props).map((key) => {
|
16
|
+
const currentValue = props[key];
|
17
|
+
const previousValue = previousProps[key];
|
18
|
+
const strictEquality = currentValue === previousValue;
|
19
|
+
const deepEquality = isEqual(currentValue, previousValue);
|
20
|
+
return {
|
21
|
+
Property: key,
|
22
|
+
"Strict (===)": strictEquality ? "✅" : "❌",
|
23
|
+
"Deep (isEqual)": deepEquality ? "✅" : "❌",
|
24
|
+
};
|
25
|
+
});
|
26
|
+
const previousResults = usePrevious(results);
|
27
|
+
const shouldPrint = render === "eachRender" || !previousResults || !isEqual(results, previousResults);
|
28
|
+
if (shouldPrint) {
|
29
|
+
// eslint-disable-next-line no-console
|
30
|
+
console.table(results);
|
31
|
+
// eslint-disable-next-line no-console
|
32
|
+
console.log("Previous props:", previousProps);
|
33
|
+
// eslint-disable-next-line no-console
|
34
|
+
console.log("Current props:", props);
|
35
|
+
}
|
36
|
+
};
|
37
|
+
//# sourceMappingURL=useDebugEquality.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useDebugEquality.js","sourceRoot":"","sources":["../../../src/base/react/useDebugEquality.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,OAAO,MAAM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,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* A hook that provides deep memoization using JSON.stringify for content comparison.
|
3
|
+
* Each instance maintains its own cache, preventing interference between multiple hook usages.
|
4
|
+
*
|
5
|
+
* @internal
|
6
|
+
*/
|
7
|
+
export declare function useDeepMemo(): <T>(key: string, value: T) => T;
|
8
|
+
//# sourceMappingURL=useDeepMemo.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useDeepMemo.d.ts","sourceRoot":"","sources":["../../../src/base/react/useDeepMemo.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,wBAAgB,WAAW,KAWN,CAAC,OAAO,MAAM,SAAS,CAAC,KAAG,CAAC,CAahD"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
// (C) 2025 GoodData Corporation
|
2
|
+
import { useRef } from "react";
|
3
|
+
/**
|
4
|
+
* A hook that provides deep memoization using JSON.stringify for content comparison.
|
5
|
+
* Each instance maintains its own cache, preventing interference between multiple hook usages.
|
6
|
+
*
|
7
|
+
* @internal
|
8
|
+
*/
|
9
|
+
export function useDeepMemo() {
|
10
|
+
const memoCache = useRef(new Map());
|
11
|
+
/**
|
12
|
+
* Memoizes a value by its stringified content, not by reference.
|
13
|
+
* Returns the same object reference if the content hasn't changed.
|
14
|
+
*
|
15
|
+
* @param key - Unique identifier for this value type
|
16
|
+
* @param value - The value to memoize
|
17
|
+
* @returns The memoized value with stable reference
|
18
|
+
*/
|
19
|
+
function memoize(key, value) {
|
20
|
+
const valueKey = JSON.stringify(value);
|
21
|
+
const cacheKey = `${key}:${valueKey}`;
|
22
|
+
if (memoCache.current.has(cacheKey)) {
|
23
|
+
return memoCache.current.get(cacheKey);
|
24
|
+
}
|
25
|
+
memoCache.current.set(cacheKey, value);
|
26
|
+
return value;
|
27
|
+
}
|
28
|
+
return memoize;
|
29
|
+
}
|
30
|
+
//# sourceMappingURL=useDeepMemo.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useDeepMemo.js","sourceRoot":"","sources":["../../../src/base/react/useDeepMemo.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B;;;;;GAKG;AACH,MAAM,UAAU,WAAW;IACvB,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,GAAG,EAAe,CAAC,CAAC;IAEjD;;;;;;;OAOG;IACH,SAAS,OAAO,CAAI,GAAW,EAAE,KAAQ;QACrC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,QAAQ,GAAG,GAAG,GAAG,IAAI,QAAQ,EAAE,CAAC;QAEtC,IAAI,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClC,OAAO,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC3C,CAAC;QAED,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useInitialProp.d.ts","sourceRoot":"","sources":["../../../src/base/react/useInitialProp.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,EAAE,MAAM,CAAC,KAAG,CAI3C,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// (C) 2022-2025 GoodData Corporation
|
2
|
+
import React from "react";
|
3
|
+
/**
|
4
|
+
* Returns initial prop value, when component mounted.
|
5
|
+
* Is changed only on full component re-mount, not on prop update.
|
6
|
+
*
|
7
|
+
* @internal
|
8
|
+
*/
|
9
|
+
export const useInitialProp = (prop) => {
|
10
|
+
const [state] = React.useState(prop);
|
11
|
+
return state;
|
12
|
+
};
|
13
|
+
//# sourceMappingURL=useInitialProp.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useInitialProp.js","sourceRoot":"","sources":["../../../src/base/react/useInitialProp.ts"],"names":[],"mappings":"AAAA,qCAAqC;AAErC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAI,IAAO,EAAK,EAAE;IAC5C,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAI,IAAI,CAAC,CAAC;IAExC,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC"}
|
package/esm/internal.js
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@gooddata/sdk-ui",
|
3
|
-
"version": "10.
|
3
|
+
"version": "10.44.0-alpha.1",
|
4
4
|
"description": "GoodData.UI SDK - Core",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -16,6 +16,7 @@
|
|
16
16
|
"type": "module",
|
17
17
|
"exports": {
|
18
18
|
".": "./esm/index.js",
|
19
|
+
"./internal": "./esm/internal.js",
|
19
20
|
"./styles/css/*": "./styles/css/*",
|
20
21
|
"./styles/scss/*": "./styles/scss/*"
|
21
22
|
},
|
@@ -39,13 +40,13 @@
|
|
39
40
|
"lz-string": "^1.5.0",
|
40
41
|
"memoize-one": "^6.0.0",
|
41
42
|
"react-fast-compare": "^3.2.0",
|
42
|
-
"react-intl": "
|
43
|
+
"react-intl": "7.1.11",
|
43
44
|
"ts-invariant": "^0.7.5",
|
44
45
|
"tslib": "2.8.1",
|
45
46
|
"uuid": "^11.1.0",
|
46
|
-
"@gooddata/sdk-backend-spi": "10.
|
47
|
-
"@gooddata/sdk-model": "10.
|
48
|
-
"@gooddata/util": "10.
|
47
|
+
"@gooddata/sdk-backend-spi": "10.44.0-alpha.1",
|
48
|
+
"@gooddata/sdk-model": "10.44.0-alpha.1",
|
49
|
+
"@gooddata/util": "10.44.0-alpha.1"
|
49
50
|
},
|
50
51
|
"devDependencies": {
|
51
52
|
"@gooddata/eslint-config": "^4.1.1",
|
@@ -53,7 +54,7 @@
|
|
53
54
|
"@microsoft/api-documenter": "^7.17.0",
|
54
55
|
"@microsoft/api-extractor": "^7.52.8",
|
55
56
|
"@testing-library/dom": "10.4.0",
|
56
|
-
"@testing-library/react": "16.0
|
57
|
+
"@testing-library/react": "16.3.0",
|
57
58
|
"@types/hoist-non-react-statics": "^3.3.1",
|
58
59
|
"@types/lodash": "^4.14.202",
|
59
60
|
"@types/node": "^22.13.0",
|
@@ -91,10 +92,10 @@
|
|
91
92
|
"typescript": "5.8.3",
|
92
93
|
"vitest": "3.2.4",
|
93
94
|
"vitest-dom": "0.1.1",
|
94
|
-
"@gooddata/
|
95
|
-
"@gooddata/
|
96
|
-
"@gooddata/sdk-backend-base": "10.
|
97
|
-
"@gooddata/sdk-backend-mockingbird": "10.
|
95
|
+
"@gooddata/i18n-toolkit": "10.44.0-alpha.1",
|
96
|
+
"@gooddata/reference-workspace": "10.44.0-alpha.1",
|
97
|
+
"@gooddata/sdk-backend-base": "10.44.0-alpha.1",
|
98
|
+
"@gooddata/sdk-backend-mockingbird": "10.44.0-alpha.1"
|
98
99
|
},
|
99
100
|
"peerDependencies": {
|
100
101
|
"react": "^16.10.0 || ^17.0.0 || ^18.0.0",
|