A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: clear variables when message is empty (#4479)
Akshay Agrawalbf73ed681afb
diff --git a/frontend/src/core/variables/__tests__/state.test.ts b/frontend/src/core/variables/__tests__/state.test.tsindex 12d2ebc423..8725a1e62e 100644--- a/frontend/src/core/variables/__tests__/state.test.ts+++ b/frontend/src/core/variables/__tests__/state.test.ts@@ -40,6 +40,22 @@ describe("cell reducer", () => {expect(state).toEqual(variables);});+ it("should clear variables", () => {+ const x = {+ name: Names.x,+ declaredBy: [CellIds.a],+ usedBy: [CellIds.b],+ };+ const variables: Variables = {+ [Names.x]: x,+ };+ actions.setVariables([x]);+ expect(state).toEqual(variables);++ actions.setVariables([]);+ expect(state).toEqual({});+ });+it("should add variables", () => {const x = {name: Names.x,diff --git a/frontend/src/core/variables/state.ts b/frontend/src/core/variables/state.tsindex 63ed1a3f8e..5d6039a6c5 100644--- a/frontend/src/core/variables/state.ts+++ b/frontend/src/core/variables/state.ts@@ -15,9 +15,6 @@ const {useActions,} = createReducerAndAtoms(initialState, {setVariables: (state, variables: Variable[]) => {- if (variables.length === 0) {- return state;- }// start with empty state, but keep the old state's metadataconst oldVariables = { ...state };const newVariables: Variables = {};