Skip to content

Revert "fix: default new cell type to markdown instead of code"#80

Merged
hamelsmu merged 1 commit intofeature/contents-servicefrom
revert-78-fix/issue-72-default-cell-markdown
Feb 13, 2026
Merged

Revert "fix: default new cell type to markdown instead of code"#80
hamelsmu merged 1 commit intofeature/contents-servicefrom
revert-78-fix/issue-72-default-cell-markdown

Conversation

@hamelsmu
Copy link
Collaborator

Reverts #78

Copilot AI review requested due to automatic review settings February 13, 2026 03:09
@hamelsmu hamelsmu merged commit 9c67bc7 into feature/contents-service Feb 13, 2026
5 checks passed
@hamelsmu hamelsmu deleted the revert-78-fix/issue-72-default-cell-markdown branch February 13, 2026 03:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reverts changes from PR #78, restoring the default behavior of creating code cells instead of markdown cells when adding new cells to a notebook. The revert removes the markup cell creation methods and their associated tests, and changes the Actions component to use code cells by default.

Changes:

  • Removed markup cell creation methods (addMarkupCellBefore, appendMarkupCell, createMarkupCell) from NotebookData class
  • Reverted CellData.run() method signature from returning string to void
  • Updated Actions component to create code cells instead of markup cells, with fallback logic for empty notebooks
  • Removed markup cell tests and vitest environment directive

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
app/src/lib/notebookData.ts Removed markup cell methods and reverted run() signature to void
app/src/lib/notebookData.test.ts Removed markup cell tests and node environment directive
app/src/components/Actions/Actions.tsx Changed from markup to code cell creation with fallback logic
Comments suppressed due to low confidence (4)

app/src/components/Actions/Actions.tsx:865

  • Unused variable mountedTabs.
  const [mountedTabs, setMountedTabs] = useState<Set<string>>(() => new Set());

app/src/components/Actions/Actions.tsx:866

  • Unused variable runName.
  const { runName } = useParams<{ runName?: string }>();

app/src/components/Actions/Actions.tsx:868

  • Unused variable cellsInitialized.
  const [cellsInitialized, setCellsInitialized] = useState(false);

app/src/components/Actions/Actions.tsx:868

  • Unused variable setCellsInitialized.
  const [cellsInitialized, setCellsInitialized] = useState(false);

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

console.log("Started run for cell", { refId: this.refId, runID });
// Update the snapshot after running to pick up any metadata changes.
this.cachedSnapshot = this.notebook.getCellSnapshot(this.refId);
this.cachedSnapshot = this.notebook.getCellSnapshot(this.refId);
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing whitespace detected at the end of this line. This should be removed to maintain code cleanliness.

Copilot uses AI. Check for mistakes.
Comment on lines +827 to +839
const newCell = data.addCodeCellAfter("");
if (!newCell) {
// Fallback: create and persist a new code cell at the end.
const cell = create(parser_pb.CellSchema, {
metadata: {},
refId: `code_${crypto.randomUUID().replace(/-/g, "")}`,
languageId: "bash",
role: parser_pb.CellRole.USER,
kind: parser_pb.CellKind.CODE,
value: "",
});
data.updateCell(cell);
}
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback logic here is unnecessarily complex and inconsistent with the internal cell creation logic. When addCodeCellAfter("") is called with an empty notebook, it will always return null because there's no cell with an empty refId. The fallback then manually creates a cell with languageId: "bash", but the private createCodeCell method defaults to "js". This inconsistency could lead to unexpected behavior where cells created through different code paths have different default languages. Consider either: 1) Checking if cellDatas is empty first and handling that case directly, or 2) Adding a simpler appendCodeCell() method to NotebookData that appends to the end regardless of existing cells, similar to the removed appendMarkupCell() method.

Suggested change
const newCell = data.addCodeCellAfter("");
if (!newCell) {
// Fallback: create and persist a new code cell at the end.
const cell = create(parser_pb.CellSchema, {
metadata: {},
refId: `code_${crypto.randomUUID().replace(/-/g, "")}`,
languageId: "bash",
role: parser_pb.CellRole.USER,
kind: parser_pb.CellKind.CODE,
value: "",
});
data.updateCell(cell);
}
// Notebook is empty; create and persist a new default code cell at the end.
const cell = create(parser_pb.CellSchema, {
metadata: {},
refId: `code_${crypto.randomUUID().replace(/-/g, "")}`,
languageId: "js",
role: parser_pb.CellRole.USER,
kind: parser_pb.CellKind.CODE,
value: "",
});
data.updateCell(cell);

Copilot uses AI. Check for mistakes.
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