diff --git a/devtools/client/debugger/src/actions/sources/loadSourceText.js b/devtools/client/debugger/src/actions/sources/loadSourceText.js index 77d5b4f4c0c9..ac9657660c32 100644 --- a/devtools/client/debugger/src/actions/sources/loadSourceText.js +++ b/devtools/client/debugger/src/actions/sources/loadSourceText.js @@ -139,14 +139,17 @@ export const loadSourceText: MemoizedAction< { cx: Context, source: Source }, ?Source > = memoizeableAction("loadSourceText", { - exitEarly: ({ source }) => !source, hasValue: ({ source }, { getState }) => { - return !!( - getSource(getState(), source.id) && - getSourceWithContent(getState(), source.id).content + return ( + !source || + !!( + getSource(getState(), source.id) && + getSourceWithContent(getState(), source.id).content + ) ); }, - getValue: ({ source }, { getState }) => getSource(getState(), source.id), + getValue: ({ source }, { getState }) => + source ? getSource(getState(), source.id) : null, createKey: ({ source }, { getState }) => { const epoch = getSourcesEpoch(getState()); return `${epoch}:${source.id}`; diff --git a/devtools/client/debugger/src/actions/sources/symbols.js b/devtools/client/debugger/src/actions/sources/symbols.js index bfe2d1d887c6..2af607e0cc2f 100644 --- a/devtools/client/debugger/src/actions/sources/symbols.js +++ b/devtools/client/debugger/src/actions/sources/symbols.js @@ -43,9 +43,10 @@ type Args = { cx: Context, source: Source }; export const setSymbols: MemoizedAction = memoizeableAction( "setSymbols", { - exitEarly: ({ source }) => source.isWasm, - hasValue: ({ source }, { getState }) => hasSymbols(getState(), source), - getValue: ({ source }, { getState }) => getSymbols(getState(), source), + hasValue: ({ source }, { getState }) => + source.isWasm || hasSymbols(getState(), source), + getValue: ({ source }, { getState }) => + source.isWasm ? null : getSymbols(getState(), source), createKey: ({ source }) => source.id, action: ({ cx, source }, thunkArgs) => doSetSymbols(cx, source, thunkArgs), } diff --git a/devtools/client/debugger/src/reducers/sources.js b/devtools/client/debugger/src/reducers/sources.js index 0d8cc670462e..02e9f4e7b24d 100644 --- a/devtools/client/debugger/src/reducers/sources.js +++ b/devtools/client/debugger/src/reducers/sources.js @@ -68,9 +68,6 @@ import type { DebuggeeState } from "./debuggee"; import { uniq } from "lodash"; export type SourcesMap = { [SourceId]: Source }; -type SourcesContentMap = { - [SourceId]: AsyncValue | null, -}; export type SourcesMapByThread = { [ThreadId]: SourcesMap }; export type BreakpointPositionsMap = { [SourceId]: BreakpointPositions }; diff --git a/devtools/client/debugger/src/utils/memoizableAction.js b/devtools/client/debugger/src/utils/memoizableAction.js index 471f4ce5a801..6e85ea6d750e 100644 --- a/devtools/client/debugger/src/utils/memoizableAction.js +++ b/devtools/client/debugger/src/utils/memoizableAction.js @@ -6,12 +6,8 @@ import type { ThunkArgs } from "../actions/types"; -export type MemoizedAction< - Args, - Result -> = Args => ThunkArgs => Promise; +export type MemoizedAction = Args => ThunkArgs => Promise; type MemoizableActionParams = { - exitEarly?: (args: Args, thunkArgs: ThunkArgs) => boolean, hasValue: (args: Args, thunkArgs: ThunkArgs) => boolean, getValue: (args: Args, thunkArgs: ThunkArgs) => Result, createKey: (args: Args, thunkArgs: ThunkArgs) => string, @@ -22,7 +18,6 @@ type MemoizableActionParams = { * memoizableActon is a utility for actions that should only be performed * once per key. It is useful for loading sources, parsing symbols ... * - * @exitEarly - if true, do not attempt to perform the action * @hasValue - checks to see if the result is in the redux store * @getValue - gets the result from the redux store * @createKey - creates a key for the requests map @@ -49,15 +44,10 @@ export function memoizeableAction( getValue, createKey, action, - exitEarly, }: MemoizableActionParams ): MemoizedAction { const requests = new Map(); return args => async (thunkArgs: ThunkArgs) => { - if (exitEarly && exitEarly(args, thunkArgs)) { - return; - } - if (hasValue(args, thunkArgs)) { return getValue(args, thunkArgs); }