Skip to content

Commit cd4df73

Browse files
authored
Fix error message flashing constantly on Github (#19)
1 parent 278e8d7 commit cd4df73

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/lib/integrations/github.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export const Github: Integration = {
103103
return branch;
104104
} else {
105105
const results =
106-
/^https?:[/][/][^/]+[/](?<repo>[^/]+[/][^/]+)([/]?tree[/](?<branch>[^?]+))?/i.exec(
106+
/^https?:[/][/][^/]+[/](?<repo>[^/]+[/][^/]+)([/]?tree[/](?<branch>[^?]+))/i.exec(
107107
url.toString(),
108108
)?.groups;
109109
if (!results) {

src/pages/Content.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ function init(attempts: number = 0) {
2525
if (buttonContainer && document.contains(buttonContainer)) {
2626
// Already initialized
2727
if (!isElementVisible(buttonContainer)) {
28-
// Button is no longer visible, we need to try to place it again
29-
buttonContainer?.remove();
30-
debouncedInit();
28+
// Button is no longer visible, try to move it to a new visible location
29+
const integration = getSupportedIntegration(window.location.href);
30+
const buttonTarget = integration?.getButtonTarget(document);
31+
buttonTarget?.appendChild(buttonContainer);
3132
}
3233
return;
3334
}

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default defineConfig({
2828
},
2929
plugins: [
3030
react(),
31-
process.env.PREVIEW !== "false" &&
31+
process.env.PREVIEW !== "true" &&
3232
webExtension({
3333
manifest: generateManifest,
3434
disableAutoLaunch: false,

0 commit comments

Comments
 (0)