Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
1b7188c
initial work to remove CellValue::Code (virtually)
davidfig Sep 9, 2025
75effb7
adding new code cell works
davidfig Sep 10, 2025
062bf4b
getting edit code cell works
davidfig Sep 10, 2025
cb0fd35
in progress
davidfig Sep 10, 2025
a075a87
Merge remote-tracking branch 'origin/qa' into remove-code-cell-value
davidfig Sep 11, 2025
fb421ea
starting work on file migration
davidfig Sep 11, 2025
78e2f78
cleaning up
davidfig Sep 12, 2025
30f76f2
continuing to work through syntax errors
davidfig Sep 12, 2025
86b0402
cleaning up
davidfig Sep 13, 2025
5c3312a
fixed all syntax errors
davidfig Sep 13, 2025
0ddcfd1
working through tests
davidfig Sep 14, 2025
5ec3a15
removing dbg
davidfig Sep 14, 2025
b8aa197
cleaning up
davidfig Sep 14, 2025
b31846f
fix search
davidfig Sep 14, 2025
8177205
cleaning up
davidfig Sep 14, 2025
521b95b
more tests
davidfig Sep 15, 2025
ff1d74f
execute_col_rows test
davidfig Sep 15, 2025
3722a85
fi code in clipboard (somewhat)
davidfig Sep 15, 2025
f0dff20
fixing tests
davidfig Sep 15, 2025
cf26642
cleaning up
davidfig Sep 16, 2025
dce3eff
fix test
davidfig Sep 16, 2025
61eb83e
remove old test that's not relevant
davidfig Sep 16, 2025
6240739
fix test
davidfig Sep 16, 2025
e60ab3c
fix spill test
davidfig Sep 16, 2025
da5025f
more test fixes
davidfig Sep 16, 2025
2c89350
another test fix
davidfig Sep 16, 2025
637f7d1
cleaning up
davidfig Sep 17, 2025
cd5dbff
test_duplicate_sheet_with_data_table
davidfig Sep 18, 2025
1d7aa35
adjust_code_cells_javascript
davidfig Sep 18, 2025
0a6a194
adjust_code_cells_python
davidfig Sep 18, 2025
d367b2e
test_calculation_get_cells_self_reference
davidfig Sep 18, 2025
511ceac
WIP
davidfig Sep 18, 2025
408b351
test_execute_grid_to_data_table
davidfig Sep 18, 2025
701dbee
WIP
davidfig Sep 18, 2025
366429e
test_set_code_cell_with_table_name
davidfig Sep 18, 2025
d572bc5
test_grid_to_data_table_operations
davidfig Sep 18, 2025
d195ae3
test_set_code_cell_operations
davidfig Sep 18, 2025
4a61709
test_javascript_does_not_replace_output_until_complete
davidfig Sep 18, 2025
596b09d
wip on spills caused by code cells (not sure what to do with this)
davidfig Sep 18, 2025
7c05280
test_receive_overlapping_multiplayer_while_waiting_for_async
davidfig Sep 18, 2025
313bce9
clean up tests and remove dbg
davidfig Sep 18, 2025
1fc3b98
added comments for test
davidfig Sep 19, 2025
44f24b5
fix bug with clipboard paste
davidfig Sep 20, 2025
32f80a9
adjust references for clipboard
davidfig Sep 20, 2025
2add851
cleaning up
davidfig Sep 21, 2025
e1b7ef9
more test fixes
davidfig Sep 21, 2025
301c165
cleaning up
davidfig Sep 22, 2025
e501741
fix delete table based on deleting col/rows
davidfig Sep 22, 2025
ef246ee
more tests
davidfig Sep 22, 2025
3dce1be
fixed printing of charts in
davidfig Sep 22, 2025
464e735
fix test
davidfig Sep 22, 2025
c93671e
more test fixes
davidfig Sep 22, 2025
db515d2
fix test
davidfig Sep 22, 2025
f7ee5bb
more test fixes
davidfig Sep 22, 2025
cf208cb
adding new op
davidfig Sep 22, 2025
a81a449
chart size undos
davidfig Sep 23, 2025
2f95755
more col/row work
davidfig Sep 23, 2025
3ea4523
test
davidfig Sep 23, 2025
e29cae9
more tests
davidfig Sep 23, 2025
ed10218
remaining col/row tests
davidfig Sep 23, 2025
b43e3bd
fix a test that no longer makes sense
davidfig Sep 23, 2025
0083cae
fix test
davidfig Sep 23, 2025
60d1964
fix test
davidfig Sep 23, 2025
86d87cc
cleaning up
davidfig Sep 24, 2025
227a3c3
tst
davidfig Sep 24, 2025
3093515
more tests
davidfig Sep 24, 2025
a144020
fix test
davidfig Sep 24, 2025
dda473e
fix test
davidfig Sep 24, 2025
51a3f11
test
davidfig Sep 24, 2025
5179d08
more tests
davidfig Sep 24, 2025
78f262a
test
davidfig Sep 24, 2025
615036e
test
davidfig Sep 24, 2025
37b2efb
test
davidfig Sep 24, 2025
e5d15a7
test
davidfig Sep 24, 2025
a30bfa9
cut/copy code w/reference updates
davidfig Sep 24, 2025
9bb3689
fix test
davidfig Sep 24, 2025
a631e78
fix test
davidfig Sep 24, 2025
b5f34bd
Merge remote-tracking branch 'origin/qa' into remove-code-cell-value
davidfig Sep 25, 2025
1ac8074
fix merge issues
davidfig Sep 25, 2025
c27a767
fix test failures
davidfig Sep 25, 2025
b32b1ba
clippy
davidfig Sep 25, 2025
caf3589
ts errors
davidfig Sep 25, 2025
81c12f5
migration
AyushAgrawal-A2 Sep 25, 2025
d90a999
nits
AyushAgrawal-A2 Sep 25, 2025
ba39e7d
Merge branch 'qa' of github.com:quadratichq/quadratic into remove-cod…
AyushAgrawal-A2 Sep 25, 2025
924c45a
migration tests
AyushAgrawal-A2 Sep 25, 2025
0de0a0b
ts
AyushAgrawal-A2 Sep 25, 2025
b362c74
fix
AyushAgrawal-A2 Sep 26, 2025
9f5cd37
Merge branch 'qa' of github.com:quadratichq/quadratic into remove-cod…
AyushAgrawal-A2 Sep 26, 2025
6cca3e2
data table cache
AyushAgrawal-A2 Sep 27, 2025
5838a1d
animate running table
davidfig Sep 27, 2025
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
2 changes: 2 additions & 0 deletions quadratic-client/src/app/ai/hooks/useAITransactions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ const OperationToChatMessage: OperationMessageMap<TrackedOperation> = {
RowsMoved: (operation) =>
`- moved rows ${operation.from_range[0]}-${operation.from_range[1]} to ${operation.to} in sheet ${operation.sheet_name}`,
ComputeCode: (operation) => `- computed code at ${operation.selection}`,
MoveDataTable: (operation) => `- moved data table from ${operation.from} to ${operation.to}`,
SwitchDataTableKind: (operation) => `- switched data table at ${operation.selection} to ${operation.kind}`,
};

const convertTransactionToChatMessage = (transaction: TrackedTransaction): string => {
Expand Down
4 changes: 0 additions & 4 deletions quadratic-client/src/app/ai/utils/aiToMarkdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ const convertJsCellValue = (cell: JsCellValueCode, showLanguage: boolean): strin
return `"This cell contains an error"`;
} else if (cell.kind === 'Html') {
return `"This cell contains html"`;
} else if (cell.kind === 'Code') {
return `"This cell contains code"`;
} else if (cell.kind === 'Image') {
return `"This cell contains an image"`;
} else if (cell.kind === 'Import') {
return `"This cell contains an import"`;
} else {
if (cell.kind !== 'Blank') {
Expand Down
2 changes: 1 addition & 1 deletion quadratic-client/src/app/gridGL/cells/tables/Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import type { Point } from 'pixi.js';
import { Container, Rectangle } from 'pixi.js';

export class Table extends Container {
private outline: TableOutline;
public active = false;
outline: TableOutline;

// Header is either a child of Table or, when it is sticky, a child of
// pixiApp.overHeadings.
Expand Down
22 changes: 21 additions & 1 deletion quadratic-client/src/app/gridGL/cells/tables/TableOutline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { events } from '@/app/events/events';
import type { Table } from '@/app/gridGL/cells/tables/Table';
import { generatedTextures } from '@/app/gridGL/generateTextures';
import { pixiApp } from '@/app/gridGL/pixiApp/PixiApp';
import { pixiAppSettings } from '@/app/gridGL/pixiApp/PixiAppSettings';
import { getCSSVariableTint } from '@/app/helpers/convertColor';
import { colors } from '@/app/theme/colors';
Expand All @@ -12,9 +13,13 @@ import { Graphics, Rectangle } from 'pixi.js';
const SPILL_HIGHLIGHT_THICKNESS = 1;
const SPILL_FILL_ALPHA = 0.05;

const RUNNING_ALPHA_TIME = 250;

export class TableOutline extends Graphics {
private table: Table;

running: boolean | 'awaiting' = false;

constructor(table: Table) {
super();
this.table = table;
Expand All @@ -29,9 +34,22 @@ export class TableOutline extends Graphics {
super.destroy();
};

update = () => {
update = (runningCount?: number) => {
this.clear();

if (this.running && runningCount) {
const running = runningCount % RUNNING_ALPHA_TIME;
let change = 0;
if (running < RUNNING_ALPHA_TIME / 2) {
change = running / (RUNNING_ALPHA_TIME / 2);
} else {
change = 1 - (running - RUNNING_ALPHA_TIME / 2) / (RUNNING_ALPHA_TIME / 2);
}
this.beginFill(getCSSVariableTint('background'), 0.75 * change);
this.drawRect(0, 0, this.table.tableBounds.width, this.table.tableBounds.height);
this.endFill();
}

if (!pixiAppSettings.showCellTypeOutlines) return;

// draw the table selected outline
Expand Down Expand Up @@ -75,6 +93,8 @@ export class TableOutline extends Graphics {
this.drawDashedRectangle(rectangle, colors.cellColorError);
});
}

pixiApp.setViewportDirty();
};

// draw a dashed and filled rectangle to identify the cause of the spill error
Expand Down
69 changes: 69 additions & 0 deletions quadratic-client/src/app/gridGL/cells/tables/Tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { pixiApp } from '@/app/gridGL/pixiApp/PixiApp';
import { pixiAppSettings } from '@/app/gridGL/pixiApp/PixiAppSettings';
import type { JsCoordinate, JsHtmlOutput, JsRenderCodeCell, JsUpdateCodeCell } from '@/app/quadratic-core-types';
import { fromUint8Array } from '@/app/shared/utils/Uint8Array';
import type { CodeRun } from '@/app/web-workers/CodeRun';
import type { LanguageState } from '@/app/web-workers/languageTypes';
import type { CoreClientImage } from '@/app/web-workers/quadraticCore/coreClientMessages';
import { Container, type Point, type Rectangle } from 'pixi.js';

Expand Down Expand Up @@ -55,6 +57,9 @@ export class Tables extends Container<Table> {

tableCursor: string | undefined;

private runningState: string[] = [];
private runningCount = 0;

constructor(cellsSheet: CellsSheet) {
super();
this.cellsSheet = cellsSheet;
Expand All @@ -74,6 +79,10 @@ export class Tables extends Container<Table> {
events.on('htmlOutput', this.htmlOutput);
events.on('htmlUpdate', this.htmlUpdate);
events.on('updateImage', this.updateImage);

events.on('pythonState', this.updateRunningState);
events.on('javascriptState', this.updateRunningState);
events.on('connectionState', this.updateRunningState);
}

destroy() {
Expand All @@ -90,6 +99,10 @@ export class Tables extends Container<Table> {
events.off('htmlUpdate', this.htmlUpdate);
events.off('updateImage', this.updateImage);

events.off('pythonState', this.updateRunningState);
events.off('javascriptState', this.updateRunningState);
events.off('connectionState', this.updateRunningState);

super.destroy();
}

Expand Down Expand Up @@ -286,6 +299,14 @@ export class Tables extends Container<Table> {
const visibleTables = this.getVisibleTables();
visibleTables?.forEach((table) => table.update(bounds, gridHeading));
}
if (this.runningState.length !== 0) {
this.runningCount++;
for (const tablePos of this.runningState) {
const [x, y] = tablePos.split(',');
const table = this.getTable(Number(x), Number(y));
table?.outline.update(this.runningCount);
}
}
};

private handleA1ContextUpdated = () => {
Expand Down Expand Up @@ -645,4 +666,52 @@ export class Tables extends Container<Table> {
};

//#endregion

private updateRunningState = (_state: LanguageState, current?: CodeRun, awaitingExecution?: CodeRun[]) => {
if (!current && !awaitingExecution) {
for (const tablePos of this.runningState) {
const [x, y] = tablePos.split(',');
const table = this.getTable(Number(x), Number(y));
if (table) {
table.outline.running = false;
table.outline.update();
}
}
}
const newTables: { table: Table; running: true | 'awaiting' }[] = [];
if (current && current.sheetPos.sheetId === this.cellsSheet.sheetId) {
const table = this.getTable(current.sheetPos.x, current.sheetPos.y);
if (table) {
newTables.push({ table, running: true });
}
}
if (awaitingExecution) {
for (const cell of awaitingExecution) {
if (cell.sheetPos.sheetId === this.cellsSheet.sheetId) {
const table = this.getTable(cell.sheetPos.x, cell.sheetPos.y);
if (table) {
newTables.push({ table, running: 'awaiting' });
}
}
}
}

for (const tablePos of this.runningState) {
const [x, y] = tablePos.split(',');
const table = this.getTable(Number(x), Number(y));
if (table && !newTables.find((t) => t.table === table)) {
table.outline.running = false;
table.outline.update();
}
}
const newRunningState: string[] = [];
for (const table of newTables) {
if (!this.runningState.includes(`${table.table.codeCell.x},${table.table.codeCell.y}`)) {
table.table.outline.running = table.running;
table.table.outline.update();
newRunningState.push(`${table.table.codeCell.x},${table.table.codeCell.y}`);
}
}
this.runningState = newRunningState;
};
}
4 changes: 2 additions & 2 deletions quadratic-client/src/app/quadratic-core-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export type JsCellsA1Values = { cells: Array<JsCellsA1Value>, x: number, y: numb
export type JsCellValue = { value: string, kind: JsCellValueKind, };
export type JsCellValueCode = { value: string, kind: JsCellValueKind, language: CodeCellLanguage | null, };
export type JsCellValueSummary = { total_range: string, start_range: string | null, end_range: string | null, start_values: Array<Array<JsCellValueCode>> | null, end_values: Array<Array<JsCellValueCode>> | null, };
export type JsCellValueKind = "Blank" | "Text" | "Number" | "Logical" | "DateTime" | "Date" | "Time" | "Duration" | "Error" | "Html" | "Code" | "Image" | "Import";
export type JsCellValueKind = "Blank" | "Text" | "Number" | "Logical" | "DateTime" | "Date" | "Time" | "Duration" | "Error" | "Html" | "Image";
export type JsCellValuePos = { value: string, kind: JsCellValueKind, pos: string, };
export type JsCellValueRanges = { total_range: string, range: string, values: Array<Array<JsCellValueCode>> | null, };
export type JsCellValueResult = [string, number];
Expand Down Expand Up @@ -183,7 +183,7 @@ end: number, };
export type TableRef = { table_name: string, data: boolean, headers: boolean, totals: boolean, col_range: ColRange, };
export type TextCase = { "CaseInsensitive": Array<string> } | { "CaseSensitive": Array<string> };
export type TextMatch = { "Exactly": TextCase } | { "Contains": TextCase } | { "NotContains": TextCase } | { "TextLength": { min: number | null, max: number | null, } };
export type TrackedOperation = { "type": "SetCellValues", selection: string, } | { "type": "SetDataTable", selection: string, name: string | null, deleted: boolean, } | { "type": "DeleteDataTable", selection: string, } | { "type": "FlattenDataTable", selection: string, } | { "type": "GridToDataTable", selection: string, } | { "type": "DataTableColumnsChanged", selection: string, } | { "type": "DataTableRowsChanged", selection: string, } | { "type": "DataTableSorted", selection: string, } | { "type": "DataTableHeaderToggled", selection: string, first_row_is_header: boolean, } | { "type": "FormatsChanged", sheet_name: string, selection: string, } | { "type": "AddSheet", sheet_name: string, } | { "type": "DeleteSheet", sheet_name: string, } | { "type": "DuplicateSheet", sheet_name: string, duplicated_sheet_name: string, } | { "type": "SetSheetName", old_sheet_name: string, new_sheet_name: string, } | { "type": "SetSheetColor", sheet_name: string, color: string | null, } | { "type": "ReorderSheet", sheet_name: string, order: string, } | { "type": "ReplaceSheet", sheet_name: string, } | { "type": "ResizeColumn", sheet_name: string, column: bigint, new_size: number, } | { "type": "ResizeRow", sheet_name: string, row: bigint, new_size: number, } | { "type": "ColumnsResized", sheet_name: string, count: number, } | { "type": "RowsResized", sheet_name: string, count: number, } | { "type": "DefaultRowSize", sheet_name: string, size: number, } | { "type": "DefaultColumnSize", sheet_name: string, size: number, } | { "type": "CursorChanged", selection: string, } | { "type": "MoveCells", from: string, to: string, columns: boolean, rows: boolean, } | { "type": "ValidationSet", selection: string, } | { "type": "ValidationRemoved", sheet_name: string, validation_id: string, } | { "type": "ValidationRemovedSelection", sheet_name: string, selection: string, } | { "type": "ColumnInserted", sheet_name: string, column: bigint, } | { "type": "ColumnDeleted", sheet_name: string, column: bigint, } | { "type": "RowInserted", sheet_name: string, row: bigint, } | { "type": "RowDeleted", sheet_name: string, row: bigint, } | { "type": "ColumnsDeleted", sheet_name: string, columns: Array<bigint>, } | { "type": "RowsDeleted", sheet_name: string, rows: Array<bigint>, } | { "type": "ColumnsMoved", sheet_name: string, from_range: [bigint, bigint], to: bigint, } | { "type": "RowsMoved", sheet_name: string, from_range: [bigint, bigint], to: bigint, } | { "type": "ComputeCode", selection: string, };
export type TrackedOperation = { "type": "SetCellValues", selection: string, } | { "type": "SetDataTable", selection: string, name: string | null, deleted: boolean, } | { "type": "DeleteDataTable", selection: string, } | { "type": "FlattenDataTable", selection: string, } | { "type": "GridToDataTable", selection: string, } | { "type": "MoveDataTable", from: string, to: string, } | { "type": "SwitchDataTableKind", selection: string, kind: string, } | { "type": "DataTableColumnsChanged", selection: string, } | { "type": "DataTableRowsChanged", selection: string, } | { "type": "DataTableSorted", selection: string, } | { "type": "DataTableHeaderToggled", selection: string, first_row_is_header: boolean, } | { "type": "FormatsChanged", sheet_name: string, selection: string, } | { "type": "AddSheet", sheet_name: string, } | { "type": "DeleteSheet", sheet_name: string, } | { "type": "DuplicateSheet", sheet_name: string, duplicated_sheet_name: string, } | { "type": "SetSheetName", old_sheet_name: string, new_sheet_name: string, } | { "type": "SetSheetColor", sheet_name: string, color: string | null, } | { "type": "ReorderSheet", sheet_name: string, order: string, } | { "type": "ReplaceSheet", sheet_name: string, } | { "type": "ResizeColumn", sheet_name: string, column: bigint, new_size: number, } | { "type": "ResizeRow", sheet_name: string, row: bigint, new_size: number, } | { "type": "ColumnsResized", sheet_name: string, count: number, } | { "type": "RowsResized", sheet_name: string, count: number, } | { "type": "DefaultRowSize", sheet_name: string, size: number, } | { "type": "DefaultColumnSize", sheet_name: string, size: number, } | { "type": "CursorChanged", selection: string, } | { "type": "MoveCells", from: string, to: string, columns: boolean, rows: boolean, } | { "type": "ValidationSet", selection: string, } | { "type": "ValidationRemoved", sheet_name: string, validation_id: string, } | { "type": "ValidationRemovedSelection", sheet_name: string, selection: string, } | { "type": "ColumnInserted", sheet_name: string, column: bigint, } | { "type": "ColumnDeleted", sheet_name: string, column: bigint, } | { "type": "RowInserted", sheet_name: string, row: bigint, } | { "type": "RowDeleted", sheet_name: string, row: bigint, } | { "type": "ColumnsDeleted", sheet_name: string, columns: Array<bigint>, } | { "type": "RowsDeleted", sheet_name: string, rows: Array<bigint>, } | { "type": "ColumnsMoved", sheet_name: string, from_range: [bigint, bigint], to: bigint, } | { "type": "RowsMoved", sheet_name: string, from_range: [bigint, bigint], to: bigint, } | { "type": "ComputeCode", selection: string, };
export type TrackedTransaction = { source: TransactionSource, transaction_name: TransactionName, operations: Array<TrackedOperation>, time_stamp: bigint, };
export type TransactionName = "Unknown" | "ResizeColumn" | "ResizeRow" | "ResizeRows" | "ResizeColumns" | "Autocomplete" | "SetBorders" | "SetCells" | "SetFormats" | "SetDataTableAt" | "CutClipboard" | "PasteClipboard" | "SetCode" | "RunCode" | "FlattenDataTable" | "SwitchDataTableKind" | "GridToDataTable" | "DataTableMeta" | "DataTableMutations" | "DataTableFirstRowAsHeader" | "DataTableAddDataTable" | "Import" | "SetSheetMetadata" | "SheetAdd" | "SheetDelete" | "DuplicateSheet" | "ReplaceSheet" | "MoveCells" | "Validation" | "ManipulateColumnRow";
export type TransactionSource = "Unset" | "User" | "Undo" | "Redo" | "Multiplayer" | "Server" | "Unsaved" | "AI" | "UndoAI" | "RedoAI";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ describe('javascriptConvertOutputType', () => {

expect(javascriptConvertOutputType(message, [], 0, 0)).toEqual({
displayType: 'empty array',
output: ['', CellValueType.Code],
output: ['', CellValueType.Blank],
});
expect(message.length).toBe(0);

expect(javascriptConvertOutputType(message, [[], [], []], 0, 0)).toEqual({
displayType: 'empty array',
output: ['', CellValueType.Code],
output: ['', CellValueType.Blank],
});
expect(message.length).toBe(0);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function javascriptConvertOutputType(
return { output: [value ? 'true' : 'false', CellValueType.Logical], displayType: 'boolean' };
} else if (Array.isArray(value)) {
// this handles the case where the value.flat() is empty
return { output: ['', CellValueType.Code], displayType: 'empty array' };
return { output: ['', CellValueType.Blank], displayType: 'empty array' };
} else {
message.push(
`WARNING: Unsupported output type "${typeof value}" at cell(${column + (x ?? 0)}, ${
Expand Down
Loading
Loading