Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version Packages (beta) #11417

Merged
merged 1 commit into from
Dec 18, 2023
Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Dec 6, 2023

This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or setup this action to publish automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to release-3.9, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

release-3.9 is currently in pre mode so this branch has prereleases rather than normal releases. If you want to exit prereleases, run changeset pre exit on release-3.9.

⚠️⚠️⚠️⚠️⚠️⚠️

Releases

@apollo/[email protected]

Minor Changes

  • #11412 58db5c3 Thanks @jerelmiller! - Create a new useQueryRefHandlers hook that returns refetch and fetchMore functions for a given queryRef. This is useful to get access to handlers for a queryRef that was created by createQueryPreloader or when the handlers for a queryRef produced by a different component are inaccessible.

    const MyComponent({ queryRef }) {
      const { refetch, fetchMore } = useQueryRefHandlers(queryRef);
    
      // ...
    }
  • #11410 07fcf6a Thanks @sf-twingate! - Allow returning IGNORE sentinel object from optimisticResponse functions to bail-out from the optimistic update.

    Consider this example:

    const UPDATE_COMMENT = gql`
      mutation UpdateComment($commentId: ID!, $commentContent: String!) {
        updateComment(commentId: $commentId, content: $commentContent) {
          id
          __typename
          content
        }
      }
    `;
    
    function CommentPageWithData() {
      const [mutate] = useMutation(UPDATE_COMMENT);
      return (
        <Comment
          updateComment={({ commentId, commentContent }) =>
            mutate({
              variables: { commentId, commentContent },
              optimisticResponse: (vars, { IGNORE }) => {
                if (commentContent === "foo") {
                  // conditionally bail out of optimistic updates
                  return IGNORE;
                }
                return {
                  updateComment: {
                    id: commentId,
                    __typename: "Comment",
                    content: commentContent,
                  },
                };
              },
            })
          }
        />
      );
    }

    The IGNORE sentinel can be destructured from the second parameter in the callback function signature passed to optimisticResponse.

  • #11412 58db5c3 Thanks @jerelmiller! - Add the ability to start preloading a query outside React to begin fetching as early as possible. Call createQueryPreloader to create a preloadQuery function which can be called to start fetching a query. This returns a queryRef which is passed to useReadQuery and suspended until the query is done fetching.

    const preloadQuery = createQueryPreloader(client);
    const queryRef = preloadQuery(QUERY, { variables, ...otherOptions });
    
    function App() {
      return {
        <Suspense fallback={<div>Loading</div>}>
          <MyQuery />
        </Suspense>
      }
    }
    
    function MyQuery() {
      const { data } = useReadQuery(queryRef);
    
      // do something with data
    }
  • #11397 3f7eecb Thanks @aditya-kumawat! - Adds a new skipPollAttempt callback function that's called whenever a refetch attempt occurs while polling. If the function returns true, the refetch is skipped and not reattempted until the next poll interval. This will solve the frequent use-case of disabling polling when the window is inactive.

    useQuery(QUERY, {
      pollInterval: 1000,
      skipPollAttempt: () => document.hidden, // or !document.hasFocus()
    });
    // or define it globally
    new ApolloClient({
      defaultOptions: {
        watchQuery: {
          skipPollAttempt: () => document.hidden, // or !document.hasFocus()
        },
      },
    });
  • #11435 5cce53e Thanks @phryneas! - Deprecates canonizeResults.

    Using canonizeResults can result in memory leaks so we generally do not recommend using this option anymore.
    A future version of Apollo Client will contain a similar feature without the risk of memory leaks.

Patch Changes

  • #11369 2a47164 Thanks @phryneas! - Persisted Query Link: improve memory management

    • use LRU WeakCache instead of WeakMap to keep a limited number of hash results
    • hash cache is initiated lazily, only when needed
    • expose persistedLink.resetHashCache() method
    • reset hash cache if the upstream server reports it doesn't accept persisted queries
  • #10804 221dd99 Thanks @phryneas! - use WeakMap in React Native with Hermes

  • #11409 2e7203b Thanks @phryneas! - Adds an experimental ApolloClient.getMemoryInternals helper

@jerelmiller

This comment was marked as resolved.

@github-actions github-actions bot force-pushed the changeset-release/release-3.9 branch 2 times, most recently from 3d1d4dc to 679ddea Compare December 8, 2023 12:49
@github-actions github-actions bot force-pushed the changeset-release/release-3.9 branch 3 times, most recently from c8910b1 to 1c067de Compare December 15, 2023 10:00
Copy link

netlify bot commented Dec 15, 2023

Deploy Preview for apollo-client-docs ready!

Name Link
🔨 Latest commit f2d8035
🔍 Latest deploy log https://app.netlify.com/sites/apollo-client-docs/deploys/65809c3cfc5e3d0008e90408
😎 Deploy Preview https://deploy-preview-11417--apollo-client-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot force-pushed the changeset-release/release-3.9 branch 2 times, most recently from fa89813 to 80aa547 Compare December 15, 2023 16:16
@phryneas
Copy link
Member

#11220 865659b Thanks @benjamn! - Update react-native.md - Adds react native devtool in the documentation

Something wrong with the contributor again, and it points at the wrong PR - it should be @mohit23x and #11364
We need to fix this up before the release.

@github-actions github-actions bot force-pushed the changeset-release/release-3.9 branch 4 times, most recently from f0b38a8 to 24be136 Compare December 18, 2023 17:58
@jerelmiller
Copy link
Member

@phryneas that looks like a docs PR, and that was merged to main. You can see it correct here. That being said, I'd opt to remove the changeset since we don't need to release new versions of the client for docs-related changes. Will do that in main directly.

@github-actions github-actions bot force-pushed the changeset-release/release-3.9 branch from 24be136 to 42e28a4 Compare December 18, 2023 19:20
@github-actions github-actions bot force-pushed the changeset-release/release-3.9 branch from 42e28a4 to f2d8035 Compare December 18, 2023 19:23
@github-actions github-actions bot changed the title Version Packages (alpha) Version Packages (beta) Dec 18, 2023
@github-actions github-actions bot added the auto-cleanup 🤖 label Dec 18, 2023
Copy link
Contributor

@alessbell alessbell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@jerelmiller jerelmiller merged commit 3a2240f into release-3.9 Dec 18, 2023
29 of 30 checks passed
@jerelmiller jerelmiller deleted the changeset-release/release-3.9 branch December 18, 2023 19:39
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants