Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/fix-datatable-column-null.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@evidence-dev/core-components": patch
---

Fix DataTable not rendering rows when data is loaded asynchronously

Added null check in Column.svelte's checkColumnName() function to guard against data not being ready during initial render. This fixes an issue where DataTable would show the table container (search box, pagination) but no actual rows when using Query objects or when data loads asynchronously.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
*/
function checkColumnName() {
try {
// Guard against data not being ready yet (e.g., during initial render or when using Query objects)
if (!$props.data || !$props.data.length || !$props.data[0]) {
return; // Data not ready, skip validation for now - will be called again when data loads
}
if (!Object.keys($props.data[0]).includes(id)) {
error = 'Error in table: ' + id + ' does not exist in the dataset';
throw new Error(error);
Expand Down
Loading