@apollo/client 4.2.7 → 4.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @apollo/client
2
2
 
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
+
3
9
  ## 4.2.7
4
10
 
5
11
  ### Patch Changes
@@ -148,29 +148,28 @@ class ApolloClient {
148
148
  */
149
149
  if (!hasSuggestedDevtools && environment_1.__DEV__) {
150
150
  hasSuggestedDevtools = true;
151
- if (window.document &&
152
- window.top === window.self &&
153
- /^(https?|file):$/.test(window.location.protocol)) {
151
+ const win = window;
152
+ const ua = win.navigator.userAgent;
153
+ let url;
154
+ if (typeof ua === "string") {
155
+ if (ua.indexOf("Chrome/") > -1) {
156
+ url =
157
+ "https://chrome.google.com/webstore/detail/" +
158
+ "apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm";
159
+ }
160
+ else if (ua.indexOf("Firefox/") > -1) {
161
+ url =
162
+ "https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/";
163
+ }
164
+ }
165
+ if (win.document &&
166
+ win.top === win.self &&
167
+ /^(https?|file):$/.test(win.location.protocol) &&
168
+ url) {
154
169
  setTimeout(() => {
155
- if (!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
156
- const nav = window.navigator;
157
- const ua = nav && nav.userAgent;
158
- let url;
159
- if (typeof ua === "string") {
160
- if (ua.indexOf("Chrome/") > -1) {
161
- url =
162
- "https://chrome.google.com/webstore/detail/" +
163
- "apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm";
164
- }
165
- else if (ua.indexOf("Firefox/") > -1) {
166
- url =
167
- "https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/";
168
- }
169
- }
170
- if (url) {
171
- __DEV__ && invariant_1.invariant.log("Download the Apollo DevTools for a better development " +
172
- "experience: %s", url);
173
- }
170
+ if (!win.__APOLLO_DEVTOOLS_GLOBAL_HOOK__) {
171
+ __DEV__ && invariant_1.invariant.log("Download the Apollo DevTools for a better development " +
172
+ "experience: %s", url);
174
173
  }
175
174
  }, 10000);
176
175
  }