Skip to content

Commit

Permalink
fix: make a key name more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
koba04 committed Aug 14, 2021
1 parent 3e2365a commit e263a98
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/swr-devtools-extensions/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "SWR DevTools",
"description": "A DevTools for SWR to inspect your SWR cache",
"description": "A DevTool to inspect your SWR cache",
"version": "1.0",
"manifest_version": 2,
"icons": {
Expand Down
4 changes: 2 additions & 2 deletions packages/swr-devtools-extensions/src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ script.parentNode?.removeChild(script);
// proxy messages from applications to a background script
const port = chrome.runtime.connect({ name: "content" });
window.addEventListener("message", (e) => {
if (e.data?.cacheData) {
if (e.data?.__SWR_DEVTOOLS__?.cacheData) {
// console.log("received", e.data.cacheData);
port.postMessage(e.data.cacheData);
port.postMessage(e.data.__SWR_DEVTOOLS__.cacheData);
}
});
5 changes: 4 additions & 1 deletion packages/swr-devtools-extensions/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ window.__SWR_DEVTOOLS__ = {
if (isMetaCache(key)) {
return;
}
window.postMessage({ cacheData: { key, value } }, "*");
window.postMessage(
{ __SWR_DEVTOOLS__: { cacheData: { key, value } } },
"*"
);
});
},
};

0 comments on commit e263a98

Please sign in to comment.