From 5b57029fa39c1ccee9d426be057161e92c5fa759 Mon Sep 17 00:00:00 2001
From: srichman333 <sarah_n_richman@brown.edu>
Date: Mon, 29 Jan 2024 16:57:34 -0500
Subject: static schema as dataviz doesn't include itself

---
 src/client/views/nodes/DataVizBox/DataVizBox.tsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'src/client/views/nodes/DataVizBox/DataVizBox.tsx')

diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
index 1cd72e29a..66a08f13e 100644
--- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx
+++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
@@ -286,7 +286,7 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() im
                     if (!this.layoutDoc._dataViz_schemaOG){ // makes a copy of the original table for the "live" toggle
                         let csvRows = [];
                         csvRows.push(keys.join(','));
-                        for (let i = 0; i < children.length; i++) {
+                        for (let i = 0; i < children.length-1; i++) {
                             let eachRow = [];
                             for (let j = 0; j < keys.length; j++) {
                                 var cell = children[i][keys[j]];
@@ -306,7 +306,9 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() im
                     const ogHref = CsvCast(ogDoc[this.fieldKey])? CsvCast(ogDoc[this.fieldKey]).url.href : undefined;
                     const href = CsvCast(this.Document[this.fieldKey]).url.href
                     if (ogHref && !DataVizBox.datasetSchemaOG.has(href)){ // sets original dataset to the var
+                        const lastRow = current.pop();
                         DataVizBox.datasetSchemaOG.set(href, current);
+                        current.push(lastRow!);
                         fetch('/csvData?uri=' + ogHref)
                             .then(res => res.json().then(action(res => !res.errno && DataVizBox.datasetSchemaOG.set(href, res))));
                     }
-- 
cgit v1.2.3-70-g09d2

