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

Temporarily revert useSyncExternalStore changes (#8785). #9393

Merged
merged 1 commit into from
Feb 3, 2022

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented Feb 3, 2022

We are considering an accelerated release schedule for Apollo Client v3.6, which will include low-risk/additive changes from release-3.6, while postponing experimental changes depending on React 18 (which has not been finalized) to the next minor release, v3.7. This PR represents the current release-3.6 branch with PR #8785 reverted (see below for details). Specifically, this PR reverts commit 7f0d459 (#8785) and follow-up commit 5328dae.

If/once this PR looks good (note: we can manually drop any changes we don't like), we can merge it into release-3.6, then create a new release-3.7 branch from release-3.6, and cherry-pick the inverse of this commit onto that new branch, effectively recreating the useSyncExternalStore work. This refactoring should allow us to continue releasing v3.6 betas without the risk/complexity introduced by useSyncExternalStore. We are still committed to implementing that API and fully supporting React 18, with prerelease availability continuing uninterrupted in the v3.7 betas.

Now, because there have been several merges of main onto release-3.6 since those commits, and some of those merges involve useSyncExternalStore-related code, I was not able to obtain a good state simply by reverting the commits and manually resolving the conflicts.

Instead, I removed the commits during an interactive Git rebase, using --rebase-merges to replay/recreate merge commits (rather than dropping them, as rebase usually does). Once I verified tests were passing after this rebase, I constructed the current commit from the difference between the branches, which should allow us to keep the current history from before the rebase, with this commit achieving the same final state as after the rebase.

@benjamn benjamn added this to the Release 3.6 milestone Feb 3, 2022
@benjamn benjamn requested a review from brainkim February 3, 2022 22:17
@benjamn benjamn self-assigned this Feb 3, 2022
This reverts commit 7f0d459 and
follow-up commit 5328dae (move
onCompleted and onError to the snapshot function).

Because there have been several merges on release-3.6 since those
commits, and some of those merges involve useSyncExternalStore-related
code, I was not able to obtain a good state simply by reverting the
commits and manually resolving the conflicts.

Instead, I removed the commits during an interactive Git rebase, using
--rebase-merges to replay/recreate merge commits (rather than dropping
them, as rebase usually does). Once I verified tests were passing after
this rebase, I constructed the current commit from the difference
between the branches, which should allow us to keep the current history
from before the rebase, with this commit achieving the same final state
as after the rebase.

We will cherry-pick the inverse of this commit onto a new release-3.7
branch soon, so we can continue releasing v3.6 betas without the
risk/complexity introduced by useSyncExternalStore. We are still
committed to implementing that API and fully supporting React 18, with
prerelease availability continuing in the v3.7 betas.
@benjamn benjamn force-pushed the temporarily-revert-useSyncExternalStore branch from 00ac40f to 38b129e Compare February 3, 2022 22:34
Copy link
Contributor

@brainkim brainkim left a comment

Choose a reason for hiding this comment

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

Went through this file by file. It sucks to see work unrelated to useSyncExternalStore() reverted but I think I’ll be able to restore it in 3.7 or whatever.

Comment on lines +549 to +551
it('should have matching results from execution function and hook', async () => {
const query = gql`
query GetCountries($filter: String) {
Copy link
Member Author

Choose a reason for hiding this comment

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

These new tests came in with merges from main, so we'll probably want to keep them when we undo this commit. We could go ahead and remove them to simplify this PR, but having more tests seems good, and they do merge cleanly with main.

@benjamn benjamn marked this pull request as ready for review February 3, 2022 22:43
@benjamn benjamn merged commit c6ab364 into release-3.6 Feb 3, 2022
benjamn added a commit that referenced this pull request Feb 4, 2022
This reverts commit c6ab364, as
promised in PR #9393, fully restoring @brainkim's useSyncExternalStore
changes from PR #8785.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants