Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix: a hydration error in SSR apps (#76)" #78

Merged
merged 1 commit into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions packages/swr-devtools-extensions/manifest-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,6 @@
"background.js"
]
},
"permissions": [
"scripting",
"tabs",
"http://*/",
"https://*/"
],
"content_scripts": [
{
"matches": [
Expand Down
20 changes: 12 additions & 8 deletions packages/swr-devtools-extensions/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@
"background": {
"service_worker": "background.js"
},
"permissions": [
"scripting",
"tabs"
],
"host_permissions": [
"http://*/",
"https://*/"
],
"content_scripts": [
{
"matches": [
Expand All @@ -32,5 +24,17 @@
],
"run_at": "document_start"
}
],
"web_accessible_resources": [
{
"resources": [
"web-accessible.js"
],
"matches": [
"https://*/*",
"http://*/*"

]
}
]
}
8 changes: 8 additions & 0 deletions packages/swr-devtools-extensions/src/content.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { DevToolsMessage } from "swr-devtools";
import { Runtime, runtime } from "webextension-polyfill";

const injectDevToolsHook = () => {
const script = document.createElement("script");
script.setAttribute("type", "text/javascript");
script.setAttribute("src", chrome.runtime.getURL("web-accessible.js"));
document.documentElement.appendChild(script);
};
injectDevToolsHook();

export type ContentMessage =
| {
type: "load";
Expand Down
13 changes: 1 addition & 12 deletions packages/swr-devtools-extensions/src/devtools.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import { devtools, scripting } from "webextension-polyfill";
import { devtools } from "webextension-polyfill";

devtools.panels.create("SWR", "", "panel.html").then(() => {
console.log("The DevTools panel has been created");
});

scripting
.executeScript({
target: {
tabId: devtools.inspectedWindow.tabId,
allFrames: true,
},
files: ["web-accessible.js"],
})
.then((r) => console.log("executeScript has been success", r))
.catch((e) => console.log("executeScript has been failed", e));