Skip to content

Commit

Permalink
fix: Ensure we set jupytext metadata to model
Browse files Browse the repository at this point in the history
* When selectedFormts are empty, we return before setting jupytext metadata

* So, the changes are not being comitted to notebook model

* This commit fixes it by ensuring we always set metadata before returning

* Use console.debug instead of console.log to reduce log pollution

Signed-off-by: Mahendra Paipuri <mahendra.paipuri@gmail.com>
  • Loading branch information
mahendrapaipuri authored and mwouts committed Jan 13, 2024
1 parent 6c4b670 commit f596a3c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export function executePairCommand(
let selectedFormats = getSelectedFormats(notebookTracker);

// Toggle the selected format
console.log('Jupytext: executing command=' + command, selectedFormats);
console.debug('Jupytext: executing command=' + command);
if (format === 'custom') {
showErrorMessage(
trans.__('Error'),
Expand Down Expand Up @@ -256,8 +256,8 @@ export function executePairCommand(
}
if (Object.keys(jupytext).length === 0) {
(model as any).deleteMetadata('jupytext');
(model as any).setMetadata('jupytext', jupytext);
}
(model as any).setMetadata('jupytext', jupytext);
return;
}

Expand Down Expand Up @@ -332,7 +332,7 @@ export function isMetadataCommandEnabled(
export function executeMetadataCommand(
notebookTracker: INotebookTracker
): void {
console.log('Jupytext: toggling YAML header');
console.debug('Jupytext: toggling YAML header');
if (!notebookTracker.currentWidget) {
return;
}
Expand Down

0 comments on commit f596a3c

Please sign in to comment.