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

child gets out of sync with parent #120

Closed
ts-smith opened this issue Aug 19, 2015 · 3 comments
Closed

child gets out of sync with parent #120

ts-smith opened this issue Aug 19, 2015 · 3 comments
Labels

Comments

@ts-smith
Copy link

ts-smith@0f2f827

When incrementing the $first variable while there are more unshown todos, the child (TodoList) seems to get a view of the data that is "one behind" the view of the parent (TodoApp).

@yuzhi
Copy link
Contributor

yuzhi commented Aug 19, 2015

Sorry, I'm not sure I understand the problem exactly. What do you mean by "one behind" the view of the parent? Do you have examples of what the parents has, vs what the child has?
Note that setVariable is async and the parent will not get one additional edge until it has been fetched from the server and stored in Relay. You can add a onReadyState callback for when the additional edge is ready.

@ts-smith
Copy link
Author

If I do something like

{hasTodos &&
            <TodoList
              key={Math.random()}
              todos={this.props.viewer.todos}
              viewer={this.props.viewer}
            />
          }

to force the todo list to rebuild every time, the list will start to show one more item whenever the parent view gets more data. Without doing that, in order to get one more item to render, I need to increment $first twice. Then each additional increment gets one more, but behind where it should be. If I inspect the data the parent has during rendering, it has the desired items, but the child container doesn't get them. Looking at the fragments (that I believe it uses to extract from the data store or something) it has a fragment that looks like the previous query.

@steveluscher
Copy link
Contributor

We dug into this, and should have a fix for you soon. Thanks @ts-smith!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants