Skip to content

Commit 32ba799

Browse files
authored
Merge branch 'main' into martinbonnin-patch-1
2 parents ddf0abf + f25b12a commit 32ba799

5 files changed

Lines changed: 36 additions & 28 deletions

File tree

.github/workflows/close-stale-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
steps:
2222
- name: Close Stale Issues
23-
uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10.3.0
23+
uses: actions/stale@1e223db275d687790206a7acac4d1a11bd6fe629 # v10.4.0
2424
with:
2525
# # Token for the repository. Can be passed in using `{{ secrets.GITHUB_TOKEN }}`.
2626
# repo-token: # optional, default is ${{ github.token }}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# @apollo/client
22

3+
## 4.2.8
4+
5+
### Patch Changes
6+
7+
- [#13349](https://github.com/apollographql/apollo-client/pull/13349) [`501a33b`](https://github.com/apollographql/apollo-client/commit/501a33bba831828da0398c994662582054272743) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prevent the `setTimeout` in `connectToDevtools` that shows the devtools suggestion from firing when the user agent does not match Chrome or Firefox. This check was previously done inside the `setTimeout` which meant the timer was scheduled for environments where we'd never show the message anyways. For test environments, this could cause flaky tests when that `setTimeout` outlived the tests and ran after any virtual DOM was torn down and removed.
8+
39
## 4.2.7
410

511
### Patch Changes

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@apollo/client",
3-
"version": "4.2.7",
3+
"version": "4.2.8",
44
"description": "A fully-featured caching GraphQL client.",
55
"private": true,
66
"keywords": [

src/core/ApolloClient.ts

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,33 +1169,35 @@ export class ApolloClient {
11691169
*/
11701170
if (!hasSuggestedDevtools && __DEV__) {
11711171
hasSuggestedDevtools = true;
1172+
const win = window;
1173+
1174+
const ua = win.navigator.userAgent;
1175+
let url: string | undefined;
1176+
1177+
if (typeof ua === "string") {
1178+
if (ua.indexOf("Chrome/") > -1) {
1179+
url =
1180+
"https://chrome.google.com/webstore/detail/" +
1181+
"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm";
1182+
} else if (ua.indexOf("Firefox/") > -1) {
1183+
url =
1184+
"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/";
1185+
}
1186+
}
1187+
11721188
if (
1173-
window.document &&
1174-
window.top === window.self &&
1175-
/^(https?|file):$/.test(window.location.protocol)
1189+
win.document &&
1190+
win.top === win.self &&
1191+
/^(https?|file):$/.test(win.location.protocol) &&
1192+
url
11761193
) {
11771194
setTimeout(() => {
1178-
if (!(window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
1179-
const nav = window.navigator;
1180-
const ua = nav && nav.userAgent;
1181-
let url: string | undefined;
1182-
if (typeof ua === "string") {
1183-
if (ua.indexOf("Chrome/") > -1) {
1184-
url =
1185-
"https://chrome.google.com/webstore/detail/" +
1186-
"apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm";
1187-
} else if (ua.indexOf("Firefox/") > -1) {
1188-
url =
1189-
"https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/";
1190-
}
1191-
}
1192-
if (url) {
1193-
invariant.log(
1194-
"Download the Apollo DevTools for a better development " +
1195-
"experience: %s",
1196-
url
1197-
);
1198-
}
1195+
if (!(win as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
1196+
invariant.log(
1197+
"Download the Apollo DevTools for a better development " +
1198+
"experience: %s",
1199+
url
1200+
);
11991201
}
12001202
}, 10000);
12011203
}

0 commit comments

Comments
 (0)