diff --git a/devtools/client/debugger/src/actions/navigation.js b/devtools/client/debugger/src/actions/navigation.js index d8b54db5631a..fb84fad27ddd 100644 --- a/devtools/client/debugger/src/actions/navigation.js +++ b/devtools/client/debugger/src/actions/navigation.js @@ -8,9 +8,10 @@ import { clearDocuments } from "../utils/editor"; import sourceQueue from "../utils/source-queue"; import { updateThreads } from "./threads"; +import { evaluateExpressions } from "./expressions"; import { clearWasmStates } from "../utils/wasm"; -import { getMainThread } from "../selectors"; +import { getMainThread, getThreadContext } from "../selectors"; import type { Action, ThunkArgs } from "./types"; /** @@ -51,9 +52,9 @@ export function connect( traits: Object, isWebExtension: boolean ) { - return async function({ dispatch }: ThunkArgs) { + return async function({ dispatch, getState }: ThunkArgs) { await dispatch(updateThreads()); - dispatch( + await dispatch( ({ type: "CONNECT", mainThread: { @@ -66,6 +67,9 @@ export function connect( isWebExtension, }: Action) ); + + const cx = getThreadContext(getState()); + dispatch(evaluateExpressions(cx)); }; } diff --git a/devtools/client/debugger/src/actions/tests/navigation.spec.js b/devtools/client/debugger/src/actions/tests/navigation.spec.js index 50b7c0b66aa1..4e1e4fb6b250 100644 --- a/devtools/client/debugger/src/actions/tests/navigation.spec.js +++ b/devtools/client/debugger/src/actions/tests/navigation.spec.js @@ -37,6 +37,7 @@ describe("navigation", () => { const { dispatch, getState } = createStore({ fetchThreads: async () => [], getMainThread: () => "FakeThread", + evaluateExpressions: () => {}, }); await dispatch( actions.connect("http://test.com/foo", "actor", false, false) diff --git a/devtools/client/debugger/src/components/SecondaryPanes/Expressions.js b/devtools/client/debugger/src/components/SecondaryPanes/Expressions.js index f9fab8c258ea..cba4c4729e8f 100644 --- a/devtools/client/debugger/src/components/SecondaryPanes/Expressions.js +++ b/devtools/client/debugger/src/components/SecondaryPanes/Expressions.js @@ -53,7 +53,6 @@ type Props = { clearAutocomplete: typeof actions.clearAutocomplete, addExpression: typeof actions.addExpression, clearExpressionError: typeof actions.clearExpressionError, - evaluateExpressions: typeof actions.evaluateExpressions, updateExpression: typeof actions.updateExpression, deleteExpression: typeof actions.deleteExpression, openLink: typeof actions.openLink, @@ -81,11 +80,7 @@ class Expressions extends Component { } componentDidMount() { - const { cx, expressions, evaluateExpressions, showInput } = this.props; - - if (expressions.length > 0) { - evaluateExpressions(cx); - } + const { showInput } = this.props; // Ensures that the input is focused when the "+" // is clicked while the panel is collapsed @@ -404,7 +399,6 @@ export default connect( clearAutocomplete: actions.clearAutocomplete, addExpression: actions.addExpression, clearExpressionError: actions.clearExpressionError, - evaluateExpressions: actions.evaluateExpressions, updateExpression: actions.updateExpression, deleteExpression: actions.deleteExpression, openLink: actions.openLink,