Skip to content

Commit

Permalink
Add back check for devtools hook inside setTimeout
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jul 23, 2024
1 parent 6a52c58 commit 272000f
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions src/core/ApolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,29 +345,30 @@ export class ApolloClient<TCacheShape> implements DataProxy {
if (
window.document &&
window.top === window.self &&
!(window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__ &&
/^(https?|file):$/.test(window.location.protocol)
) {
setTimeout(() => {
const nav = window.navigator;
const ua = nav && nav.userAgent;
let url: string | undefined;
if (typeof ua === "string") {
if (ua.indexOf("Chrome/") > -1) {
url =
"https://chrome.google.com/webstore/detail/" +
"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm";
} else if (ua.indexOf("Firefox/") > -1) {
url =
"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/";
if (!(window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
const nav = window.navigator;
const ua = nav && nav.userAgent;
let url: string | undefined;
if (typeof ua === "string") {
if (ua.indexOf("Chrome/") > -1) {
url =
"https://chrome.google.com/webstore/detail/" +
"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm";
} else if (ua.indexOf("Firefox/") > -1) {
url =
"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/";
}
}
if (url) {
invariant.log(
"Download the Apollo DevTools for a better development " +
"experience: %s",
url
);
}
}
if (url) {
invariant.log(
"Download the Apollo DevTools for a better development " +
"experience: %s",
url
);
}
}, 10000);
}
Expand Down

0 comments on commit 272000f

Please sign in to comment.