@adaptabletools/adaptable 18.0.4 → 18.0.5
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/package.json +1 -1
- package/src/env.js +2 -2
- package/src/renderReactRoot.js +10 -8
- package/tsconfig.esm.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adaptabletools/adaptable",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.5",
|
|
4
4
|
"description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
package/src/env.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
|
|
3
|
-
PUBLISH_TIMESTAMP:
|
|
4
|
-
VERSION: "18.0.
|
|
3
|
+
PUBLISH_TIMESTAMP: 1714137320045 || Date.now(),
|
|
4
|
+
VERSION: "18.0.5" || '--current-version--',
|
|
5
5
|
};
|
package/src/renderReactRoot.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as ReactDOMClient from 'react-dom/client';
|
|
2
|
+
// we need to keep track of the roots to ensure we create a single root per container
|
|
3
|
+
// otherwise we get: "You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before. Instead, call root.render() on the existing root instead if you want to update it."
|
|
2
4
|
const renderWeakMap = new WeakMap();
|
|
3
5
|
export const renderReactRoot = (el, container) => {
|
|
4
6
|
// Keeping a reference to previous roots causes an error.
|
|
5
|
-
// Already (correctly)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
const root = ReactDOMClient.createRoot(container);
|
|
7
|
+
// Already (correctly) unmounted elements are not unmounted again, and triggers an error.
|
|
8
|
+
let root = renderWeakMap.get(container);
|
|
9
|
+
if (!root) {
|
|
10
|
+
renderWeakMap.set(container, (root = ReactDOMClient.createRoot(container)));
|
|
11
|
+
}
|
|
12
|
+
// const root = ReactDOMClient.createRoot(container);
|
|
12
13
|
root.render(el);
|
|
13
14
|
return () => {
|
|
14
15
|
// requestAnimationFrame(() => {
|
|
@@ -16,8 +17,9 @@ export const renderReactRoot = (el, container) => {
|
|
|
16
17
|
// // Warning: Attempted to synchronously unmount a root while React was already rendering. React cannot finish unmounting the root until the current render has completed, which may lead to a race condition.
|
|
17
18
|
// // https:stackoverflow.com/questions/73459382/react-18-async-way-to-unmount-root
|
|
18
19
|
// });
|
|
19
|
-
// This needs to be
|
|
20
|
+
// This needs to be synchronous, if not, in a raf it may be to late, the element may be gone.
|
|
20
21
|
// To reproduce, move this in RAF and play with filters.
|
|
21
22
|
root.unmount();
|
|
23
|
+
renderWeakMap.delete(container);
|
|
22
24
|
};
|
|
23
25
|
};
|