@headless-tree/core 0.0.0-20250918201417 → 0.0.0-20250921145249
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/CHANGELOG.md +1 -1
- package/dist/index.js +15 -5
- package/dist/index.mjs +15 -5
- package/package.json +1 -1
- package/src/core/create-tree.ts +13 -4
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -546,8 +546,8 @@ var createTree = (initialConfig) => {
|
|
|
546
546
|
},
|
|
547
547
|
setMounted: ({}, isMounted) => {
|
|
548
548
|
var _a2;
|
|
549
|
-
const ref = treeDataRef;
|
|
550
|
-
|
|
549
|
+
const ref = treeDataRef.current;
|
|
550
|
+
ref.isMounted = isMounted;
|
|
551
551
|
if (isMounted) {
|
|
552
552
|
(_a2 = ref.waitingForMount) == null ? void 0 : _a2.forEach((cb) => cb());
|
|
553
553
|
ref.waitingForMount = [];
|
|
@@ -570,9 +570,19 @@ var createTree = (initialConfig) => {
|
|
|
570
570
|
},
|
|
571
571
|
// TODO rebuildSubTree: (itemId: string) => void;
|
|
572
572
|
rebuildTree: () => {
|
|
573
|
-
var _a2;
|
|
574
|
-
|
|
575
|
-
(
|
|
573
|
+
var _a2, _b2;
|
|
574
|
+
const ref = treeDataRef.current;
|
|
575
|
+
if (ref.isMounted) {
|
|
576
|
+
rebuildItemMeta();
|
|
577
|
+
(_a2 = config.setState) == null ? void 0 : _a2.call(config, state);
|
|
578
|
+
} else {
|
|
579
|
+
(_b2 = ref.waitingForMount) != null ? _b2 : ref.waitingForMount = [];
|
|
580
|
+
ref.waitingForMount.push(() => {
|
|
581
|
+
var _a3;
|
|
582
|
+
rebuildItemMeta();
|
|
583
|
+
(_a3 = config.setState) == null ? void 0 : _a3.call(config, state);
|
|
584
|
+
});
|
|
585
|
+
}
|
|
576
586
|
},
|
|
577
587
|
scheduleRebuildTree: () => {
|
|
578
588
|
rebuildScheduled = true;
|
package/dist/index.mjs
CHANGED
|
@@ -502,8 +502,8 @@ var createTree = (initialConfig) => {
|
|
|
502
502
|
},
|
|
503
503
|
setMounted: ({}, isMounted) => {
|
|
504
504
|
var _a2;
|
|
505
|
-
const ref = treeDataRef;
|
|
506
|
-
|
|
505
|
+
const ref = treeDataRef.current;
|
|
506
|
+
ref.isMounted = isMounted;
|
|
507
507
|
if (isMounted) {
|
|
508
508
|
(_a2 = ref.waitingForMount) == null ? void 0 : _a2.forEach((cb) => cb());
|
|
509
509
|
ref.waitingForMount = [];
|
|
@@ -526,9 +526,19 @@ var createTree = (initialConfig) => {
|
|
|
526
526
|
},
|
|
527
527
|
// TODO rebuildSubTree: (itemId: string) => void;
|
|
528
528
|
rebuildTree: () => {
|
|
529
|
-
var _a2;
|
|
530
|
-
|
|
531
|
-
(
|
|
529
|
+
var _a2, _b2;
|
|
530
|
+
const ref = treeDataRef.current;
|
|
531
|
+
if (ref.isMounted) {
|
|
532
|
+
rebuildItemMeta();
|
|
533
|
+
(_a2 = config.setState) == null ? void 0 : _a2.call(config, state);
|
|
534
|
+
} else {
|
|
535
|
+
(_b2 = ref.waitingForMount) != null ? _b2 : ref.waitingForMount = [];
|
|
536
|
+
ref.waitingForMount.push(() => {
|
|
537
|
+
var _a3;
|
|
538
|
+
rebuildItemMeta();
|
|
539
|
+
(_a3 = config.setState) == null ? void 0 : _a3.call(config, state);
|
|
540
|
+
});
|
|
541
|
+
}
|
|
532
542
|
},
|
|
533
543
|
scheduleRebuildTree: () => {
|
|
534
544
|
rebuildScheduled = true;
|
package/package.json
CHANGED
package/src/core/create-tree.ts
CHANGED
|
@@ -163,8 +163,8 @@ export const createTree = <T>(
|
|
|
163
163
|
// TODO this is never used, remove
|
|
164
164
|
},
|
|
165
165
|
setMounted: ({}, isMounted) => {
|
|
166
|
-
const ref = treeDataRef as TreeDataRef;
|
|
167
|
-
|
|
166
|
+
const ref = treeDataRef.current as TreeDataRef;
|
|
167
|
+
ref.isMounted = isMounted;
|
|
168
168
|
if (isMounted) {
|
|
169
169
|
ref.waitingForMount?.forEach((cb) => cb());
|
|
170
170
|
ref.waitingForMount = [];
|
|
@@ -193,8 +193,17 @@ export const createTree = <T>(
|
|
|
193
193
|
},
|
|
194
194
|
// TODO rebuildSubTree: (itemId: string) => void;
|
|
195
195
|
rebuildTree: () => {
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
const ref = treeDataRef.current as TreeDataRef;
|
|
197
|
+
if (ref.isMounted) {
|
|
198
|
+
rebuildItemMeta();
|
|
199
|
+
config.setState?.(state);
|
|
200
|
+
} else {
|
|
201
|
+
ref.waitingForMount ??= [];
|
|
202
|
+
ref.waitingForMount.push(() => {
|
|
203
|
+
rebuildItemMeta();
|
|
204
|
+
config.setState?.(state);
|
|
205
|
+
});
|
|
206
|
+
}
|
|
198
207
|
},
|
|
199
208
|
scheduleRebuildTree: () => {
|
|
200
209
|
rebuildScheduled = true;
|