Skip to content

Commit

Permalink
Report full connection data after deleteData.
Browse files Browse the repository at this point in the history
  • Loading branch information
smelamud committed Mar 24, 2020
1 parent f56043c commit cdf4781
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,22 @@ export async function deleteData(tabId, location) {
await browser.storage.local.set({[rootsKey]: roots});
await browser.storage.local.remove(`clientData;${clientUrl};${location}`);

let nodeName;
if (location === homeRoot) {
if (roots.length === 0) {
await browser.storage.local.remove(rootKey);
return loadedData(homeRoot, {}, roots);
}
homeRoot = roots[roots.length - 1].url;
const nodeName = roots[roots.length - 1].name;
nodeName = roots[roots.length - 1].name;
await browser.storage.local.set({[rootKey]: homeRoot});

const dataKey = `clientData;${clientUrl};${homeRoot}`;
const {[dataKey]: clientData} = await browser.storage.local.get(dataKey);
ObjectPath.set(clientData, "home.nodeName", nodeName);
return loadedData(homeRoot, clientData, roots);
} else {
nodeName = getRootName(roots, homeRoot);
}
return loadedData(homeRoot, {}, roots);
const dataKey = `clientData;${clientUrl};${homeRoot}`;
const {[dataKey]: clientData} = await browser.storage.local.get(dataKey);
ObjectPath.set(clientData, "home.nodeName", nodeName);
return loadedData(homeRoot, clientData, roots);
});
if (data != null) {
broadcastMessage(data, clientUrl);
Expand Down

0 comments on commit cdf4781

Please sign in to comment.