React-apollo: Variables don't mutate after update

Created on 14 Aug 2016  路  8Comments  路  Source: apollographql/react-apollo

Hey folks, So, looks like the variables are not reactive, meaning they don't update if they are mutated. For ex, I have this scenario, initially I have set variables like so, variables: { start: 0 } and later when user scrolls to the bottom of the page, I have updated the variables to this in the updateQuery method, variables: { start: this.props.data.variables.start + 20 }. Now, here is the timeline showing the state of the variables object,

screen shot 2016-08-14 at 11 35 54

It seems, it changes the first time, but again reverses to the initial variables object. Is it the desired behaviour? I think it should update with the components state.

bug

All 8 comments

@gauravtiwari thanks for reporting this! I think it should be fixed with https://github.com/apollostack/react-apollo/pull/139

@jbaxleyiii Cool! thanks for looking into it 馃嵃

@gauravtiwari this is released in 0.4.4. Let me know if it doesn't solve the problem!

@jbaxleyiii Looks like the problem still persists - same as the initial issue. The variables mutates first time and the comes back to it's initial value.

@gauravtiwari oh no! I'll keep looking

@gauravtiwari I've been able to reproduce and have pushed a failing test. You can track progress here: https://github.com/apollostack/react-apollo/pull/150

Thanks for the report!

@gauravtiwari try 0.4.6

Awesome it works @jbaxleyiii. Have some 馃嵃

Was this page helpful?
0 / 5 - 0 ratings