I'm using this code to clear notebook-kit variables between redefining a cell:
const clearCellVariables = cell => {
cell.variables.forEach(variable => variable.delete());
cell.variables = [];
};
However, when the cell value changes from an javascript expression to another javascript expression, the output shows the string "undefined". When changing from an expression to a statement or vice versa it displays the proper value.
I have an example notebook (using embedded notebook-kit library) with the full code illustrating the problem at:
https://new.observablehq.com/@btheado/notebook-kit-clear-variables-test
Am I doing something wrong?
I'm using this code to clear notebook-kit variables between redefining a cell:
However, when the cell value changes from an javascript expression to another javascript expression, the output shows the string "undefined". When changing from an expression to a statement or vice versa it displays the proper value.
I have an example notebook (using embedded notebook-kit library) with the full code illustrating the problem at:
https://new.observablehq.com/@btheado/notebook-kit-clear-variables-test
Am I doing something wrong?