znation HF Staff commited on
Commit
fbfb380
·
1 Parent(s): 8e5c2f5

claude fix: struct field freezes the UI

Browse files

prompt: The page freezes up when a struct type column is chosen from the dropdown of 2D plot choices. Can you determine why?

Files changed (1) hide show
  1. index.html +14 -2
index.html CHANGED
@@ -156,17 +156,29 @@
156
  return div.innerHTML;
157
  }
158
 
 
 
 
 
 
 
159
  // Determine if a DuckDB type is numeric
160
  function isNumericType(type) {
 
 
 
161
  const numericTypes = ['TINYINT', 'SMALLINT', 'INTEGER', 'BIGINT', 'HUGEINT',
162
  'FLOAT', 'DOUBLE', 'DECIMAL', 'NUMERIC', 'REAL'];
163
- return numericTypes.some(t => type.toUpperCase().includes(t));
164
  }
165
 
166
  // Determine if a DuckDB type is text
167
  function isTextType(type) {
 
 
 
168
  const textTypes = ['VARCHAR', 'CHAR', 'TEXT', 'STRING'];
169
- return textTypes.some(t => type.toUpperCase().includes(t));
170
  }
171
 
172
  // Detect columns and their types from the dataset
 
156
  return div.innerHTML;
157
  }
158
 
159
+ // Determine if a DuckDB type is a complex type (struct, list, map, etc.)
160
+ function isComplexType(type) {
161
+ const complexTypes = ['STRUCT', 'LIST', 'MAP', 'UNION', 'ARRAY'];
162
+ return complexTypes.some(t => type.toUpperCase().startsWith(t));
163
+ }
164
+
165
  // Determine if a DuckDB type is numeric
166
  function isNumericType(type) {
167
+ // First check if it's a complex type
168
+ if (isComplexType(type)) return false;
169
+
170
  const numericTypes = ['TINYINT', 'SMALLINT', 'INTEGER', 'BIGINT', 'HUGEINT',
171
  'FLOAT', 'DOUBLE', 'DECIMAL', 'NUMERIC', 'REAL'];
172
+ return numericTypes.some(t => type.toUpperCase().startsWith(t));
173
  }
174
 
175
  // Determine if a DuckDB type is text
176
  function isTextType(type) {
177
+ // First check if it's a complex type
178
+ if (isComplexType(type)) return false;
179
+
180
  const textTypes = ['VARCHAR', 'CHAR', 'TEXT', 'STRING'];
181
+ return textTypes.some(t => type.toUpperCase().startsWith(t));
182
  }
183
 
184
  // Detect columns and their types from the dataset