Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Rerender#1849

Merged
jbaxleyiii merged 5 commits intomasterfrom
rerender
Mar 26, 2018
Merged

Rerender#1849
jbaxleyiii merged 5 commits intomasterfrom
rerender

Conversation

@jbaxleyiii
Copy link
Copy Markdown
Contributor

This is a variation of #1809 to fix #1777. Thanks @akiran for the first stab at this!

@jbaxleyiii jbaxleyiii merged commit 0503447 into master Mar 26, 2018
@jbaxleyiii jbaxleyiii deleted the rerender branch March 26, 2018 15:29
@ghost
Copy link
Copy Markdown

ghost commented Mar 26, 2018

Can you release please?

@stenin-nikita
Copy link
Copy Markdown

stenin-nikita commented May 13, 2018

@jbaxleyiii The problem can not be solved if an error occurs.

Edit React Apollo 2, twice rendering on error.

Perhaps if an error occurred, do the same?

    this.querySubscription = this.queryObservable!.subscribe({
      next: () => {
        // to prevent a quick second render from the subscriber
        // we compare to see if the original started finished (from cache)
        if (current && current.networkStatus === 7) {
          // remove this for future rerenders (i.e. polling)
          current = undefined;
          return;
        }
        this.updateCurrentData();
      },
      error: error => {
        if (current && current.networkStatus === 7) {
          // remove this for future rerenders (i.e. polling)
          current = undefined;
          return;
        }
        this.resubscribeToQuery();
        // Quick fix for https://github.com/apollostack/react-apollo/issues/378
        if (!error.hasOwnProperty('graphQLErrors')) throw error;

        this.updateCurrentData();
      },
    });

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.

Apollo 2, useless re-render (twice render). Simple example, simple reproduction on codesandbox.

2 participants