fix selection bug for empty portal table

This commit is contained in:
Brent Schroeter 2025-12-11 08:08:41 +00:00
parent e376582f12
commit a341a317fc

View file

@ -201,7 +201,7 @@
{ additive }: { additive?: boolean } = {}, { additive }: { additive?: boolean } = {},
) { ) {
if (!lazy_data || selections.length === 0) { if (!lazy_data || selections.length === 0) {
console.warn("move_selection() preconditions not met"); console.warn("move_cursor() preconditions not met");
return; return;
} }
@ -547,8 +547,14 @@
), ),
}, },
]; ];
if (lazy_data.rows.length > 0 && lazy_data.fields.length > 0) { if (lazy_data.fields.length > 0) {
set_selections([{ region: "main", row_idx: 0, field_idx: 0 }]); set_selections([
{
region: lazy_data.rows.length > 0 ? "main" : "inserter",
row_idx: 0,
field_idx: 0,
},
]);
} }
})().catch(console.error); })().catch(console.error);