Skip to content

Commit

Permalink
Merge pull request #214 from apollographql/main
Browse files Browse the repository at this point in the history
Create a new pull request by comparing changes across two branches
  • Loading branch information
GulajavaMinistudio authored Jul 26, 2024
2 parents 95d7a0d + 3d9eb47 commit 5913581
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 51 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/snapshot-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ jobs:
id: get-version
run: echo "version=$(node -p "require('./dist/package.json').version")" >> "$GITHUB_OUTPUT"

- name: Deprecate version
if: ${{ steps.added-files.outputs.changesets != '' }}
run: npm deprecate @apollo/client@${{ steps.get-version.outputs.version }} "This is a snapshot release from https://github.com/apollographql/apollo-client/pull/${{ github.event.issue.number }}. Use at your own discretion."

- name: Create comment
if: ${{ steps.added-files.outputs.changesets != '' }}
uses: peter-evans/create-or-update-comment@v4.0.0
Expand Down
4 changes: 2 additions & 2 deletions .size-limits.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"dist/apollo-client.min.cjs": 40179,
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32990
"dist/apollo-client.min.cjs": 40164,
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32977
}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# @apollo/client

## 3.11.1

### Patch Changes

- [#11969](https://github.com/apollographql/apollo-client/pull/11969) [`061cab6`](https://github.com/apollographql/apollo-client/commit/061cab6627abd4ec81f83c40c1d281c418627c93) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Remove check for `window.__APOLLO_CLIENT__` when determining whether to connect to Apollo Client Devtools when `connectToDevtools` or `devtools.enabled` is not specified. This now simply checks to see if the application is in development mode.

- [#11971](https://github.com/apollographql/apollo-client/pull/11971) [`ecf77f6`](https://github.com/apollographql/apollo-client/commit/ecf77f6f5b5ccf64cfba51e838e96549fb6c92fe) Thanks [@jerelmiller](https://github.com/jerelmiller)! - Prevent the `setTimeout` for suggesting devtools from running in non-browser environments.

## 3.11.0

### Potentially Breaking Fixes
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@apollo/client",
"version": "3.11.0",
"version": "3.11.1",
"description": "A fully-featured caching GraphQL client.",
"private": true,
"keywords": [
Expand Down
91 changes: 45 additions & 46 deletions src/core/ApolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,7 @@ export class ApolloClient<TCacheShape> implements DataProxy {
};

if (this.devtoolsConfig.enabled === undefined) {
this.devtoolsConfig.enabled =
typeof window === "object" &&
(window as any).__APOLLO_CLIENT__ &&
__DEV__;
this.devtoolsConfig.enabled = __DEV__;
}

if (ssrForceFetchDelay) {
Expand Down Expand Up @@ -322,57 +319,59 @@ export class ApolloClient<TCacheShape> implements DataProxy {
}

private connectToDevTools() {
if (typeof window === "object") {
type DevToolsConnector = {
push(client: ApolloClient<any>): void;
};
const windowWithDevTools = window as Window & {
[devtoolsSymbol]?: DevToolsConnector;
__APOLLO_CLIENT__?: ApolloClient<any>;
};
const devtoolsSymbol = Symbol.for("apollo.devtools");
(windowWithDevTools[devtoolsSymbol] =
windowWithDevTools[devtoolsSymbol] || ([] as DevToolsConnector)).push(
this
);
windowWithDevTools.__APOLLO_CLIENT__ = this;
if (typeof window === "undefined") {
return;
}

type DevToolsConnector = {
push(client: ApolloClient<any>): void;
};
const windowWithDevTools = window as Window & {
[devtoolsSymbol]?: DevToolsConnector;
__APOLLO_CLIENT__?: ApolloClient<any>;
};
const devtoolsSymbol = Symbol.for("apollo.devtools");
(windowWithDevTools[devtoolsSymbol] =
windowWithDevTools[devtoolsSymbol] || ([] as DevToolsConnector)).push(
this
);
windowWithDevTools.__APOLLO_CLIENT__ = this;

/**
* Suggest installing the devtools for developers who don't have them
*/
if (!hasSuggestedDevtools && __DEV__) {
hasSuggestedDevtools = true;
setTimeout(() => {
if (
typeof window !== "undefined" &&
window.document &&
window.top === window.self &&
!(window as any).__APOLLO_DEVTOOLS_GLOBAL_HOOK__ &&
/^(https?|file):$/.test(window.location.protocol)
) {
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.document &&
window.top === window.self &&
/^(https?|file):$/.test(window.location.protocol)
) {
setTimeout(() => {
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);
}, 10000);
}
}
}

Expand Down

0 comments on commit 5913581

Please sign in to comment.