Closed alex-wilmer closed 8 years ago
Ah I figured this out.. I was setting the variable in prepareParams
export const prepareViewerParams = (params, { location: { query } }) => ({
offset: parseIntParam(query.offset, 0),
first: parseIntParam(query.first, 20),
filters: parseJsonParam(query.filters, null), <-- setting filters variable
sort: query.sort || '',
})
const CartRoute = h(Route, {
path: '/cart',
component: CartPage,
prepareParams: prepareViewerParams, <--updating variable
queries: viewerQuery,
})
I can't tell if this is expected behaviour or not. I have a component that loads values from localStorage and calls
setVariables
to retrigger a query. As the user continues to modify the state,setVariables
is called again, but until the new query has come back, Relay returns the props from the first query not the most recent one. This causes the intialVariable state to flicker briefly. Why would Relay send different props to the component at all untilsetVariables
has finished?