-
-
Save darkwing/f8d5c430f1fd6f8dffd15d36ab57f10e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/reducers/tabs.js b/src/reducers/tabs.js | |
index c0fd22ea6..0c61e5b7e 100644 | |
--- a/src/reducers/tabs.js | |
+++ b/src/reducers/tabs.js | |
@@ -12,7 +12,7 @@ | |
import { createSelector } from "reselect"; | |
import move from "lodash-move"; | |
-import { prefs } from "../utils/prefs"; | |
+import { prefs, asyncStore } from "../utils/prefs"; | |
import { | |
getSource, | |
getSources, | |
@@ -27,22 +27,24 @@ import type { SourcesState } from "./sources"; | |
type Tab = { url: string, framework?: string | null }; | |
export type TabList = Tab[]; | |
-function update(state: TabList = prefs.tabs || [], action: Action): TabList { | |
+async function update(state: TabList = [], action: Action): TabList { | |
+ const currentTabs = await asyncStore.tabs; | |
+ | |
switch (action.type) { | |
case "ADD_TAB": | |
case "UPDATE_TAB": | |
- return updateTabList(state, action); | |
+ updateTabList(currentTabs, action); | |
case "MOVE_TAB": | |
- return moveTabInList(state, action); | |
+ moveTabInList(currentTabs, action); | |
case "CLOSE_TAB": | |
case "CLOSE_TABS": | |
- prefs.tabs = action.tabs; | |
- return action.tabs; | |
+ // prefs.tabs = action.tabs; | |
+ asyncStore.tabs = action.tabs; | |
default: | |
- return state; | |
+ // return state; | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/utils/prefs.js b/src/utils/prefs.js | |
index e30a00fa2..ee2e16ea6 100644 | |
--- a/src/utils/prefs.js | |
+++ b/src/utils/prefs.js | |
@@ -114,12 +114,14 @@ export const features = new PrefsHelper("devtools.debugger.features", { | |
}); | |
export const asyncStore = asyncStoreHelper("debugger", { | |
- pendingBreakpoints: ["pending-breakpoints", {}] | |
+ pendingBreakpoints: ["pending-breakpoints", {}], | |
+ tabs: ["tabs", []] | |
}); | |
if (prefs.debuggerPrefsSchemaVersion !== prefsSchemaVersion) { | |
// clear pending Breakpoints | |
prefs.pendingBreakpoints = {}; | |
prefs.tabs = []; | |
+ asyncStore.tabs = []; // Hmm, not sure if we need this | |
prefs.debuggerPrefsSchemaVersion = prefsSchemaVersion; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment