Skip to content

Commit

Permalink
useSubscription: fix rules of React violations (#11863)
Browse files Browse the repository at this point in the history
* Revert "Merge pull request #9707 from kazekyo/fix_usesubscription_in_strict_mode"

This reverts commit 4571e1a, reversing
changes made to 5be85a0.

* essentially rewrite useSubscription

* use `setResult` update method

* adjust tests

* change observable during render; lazy initialization of subscription

* no more need for stable options, performance optimization

* changeset

* adjust documentation

* review feedback

* Apply suggestions from code review

Co-authored-by: Jerel Miller <jerelmiller@gmail.com>

* clarify comment

* update size-limits

* fix test

---------

Co-authored-by: Jerel Miller <jerelmiller@gmail.com>
  • Loading branch information
phryneas and jerelmiller authored Jul 3, 2024
1 parent ffb21ce commit 98e44f7
Show file tree
Hide file tree
Showing 6 changed files with 370 additions and 356 deletions.
5 changes: 5 additions & 0 deletions .changeset/little-suits-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": minor
---

Reimplement `useSubscription` to fix rules of React violations.
2 changes: 1 addition & 1 deletion .size-limits.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"dist/apollo-client.min.cjs": 39604,
"dist/apollo-client.min.cjs": 39619,
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32852
}
Loading

0 comments on commit 98e44f7

Please sign in to comment.