@lavalogic/scoria 0.25.1 → 0.25.2
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.
|
@@ -34,13 +34,27 @@
|
|
|
34
34
|
const keyOrPromise: RowIdType | Promise<RowIdType> = $derived(
|
|
35
35
|
tableContext.selectionExtractor(cell.row.original)
|
|
36
36
|
);
|
|
37
|
-
const
|
|
37
|
+
const isSelectableMaybePromise = $derived(
|
|
38
38
|
(cell.column.columnDef as RowSelectionDef<T>).isSelectable(
|
|
39
39
|
cell.row.original,
|
|
40
40
|
cell.row.originalIndex
|
|
41
41
|
)
|
|
42
42
|
);
|
|
43
43
|
|
|
44
|
+
let isSelectable = $state(false);
|
|
45
|
+
|
|
46
|
+
$effect(() => {
|
|
47
|
+
if (isSelectableMaybePromise instanceof Promise) {
|
|
48
|
+
isSelectableMaybePromise
|
|
49
|
+
.then((it) => {
|
|
50
|
+
isSelectable = it;
|
|
51
|
+
})
|
|
52
|
+
.catch(devCatch);
|
|
53
|
+
} else {
|
|
54
|
+
isSelectable = isSelectableMaybePromise;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
|
|
44
58
|
// Sync path (common): uses selectedItems.has(key) for per-key reactive tracking —
|
|
45
59
|
// only this row's checkbox re-runs when its specific key changes.
|
|
46
60
|
// Async path (rare): returns null and defers to _isSelectedAsync updated by the $effect below.
|
|
@@ -56,7 +70,9 @@
|
|
|
56
70
|
let _isSelectedAsync: boolean = $state(false);
|
|
57
71
|
$effect(() => {
|
|
58
72
|
const k = keyOrPromise;
|
|
59
|
-
if (!(k instanceof Promise)) {
|
|
73
|
+
if (!(k instanceof Promise)) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
60
76
|
void tableContext.selectedItems.size; // re-run when selection changes
|
|
61
77
|
k.then((key) => {
|
|
62
78
|
_isSelectedAsync = tableContext.selectedItems.has(key);
|