Skip to content

Conversation

@yogithesymbian
Copy link

@yogithesymbian yogithesymbian commented May 16, 2025

βœ… This ensures .length is only called on arrays.

case :

main.js:344 TypeError: Cannot read properties of null (reading 'length')
    at VueComponent.showEmptySlot (vue-good-table.esm.js:13780:82)

βœ… Root Cause
this.paginated[0].children is null or undefined, so accessing .length throws an error.

🧩 Fix 1: Check Your rows Data / santizied the children also works

rows = rows.map(r => ({
  ...r,
  children: r.children ?? [], // replace null with empty array
}));

or

function sanitizeRows(rows) {
  return (rows || []).map(row => {
    const sanitized = { ...row };
    if (row.children === null || row.children === undefined) {
      sanitized.children = [];
    } else if (Array.isArray(row.children)) {
      sanitized.children = sanitizeRows(row.children); // recurse
    }
    return sanitized;
  });
}

or

never use rows as null . use [ ] instead

🧩 Fix 2: modified dist πŸ˜‡

βœ… This ensures .length is only called on arrays.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant