You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReact,{Component}from'react';import{resolve,client}from"react-resolver";importPromisefrom'bluebird';exportclassSearchPageextendsComponent{render(){console.log("Re-Rendering: ",this.props.user);return<div>
Prop: {this.props.user}</div>}}// uncomment this and you'll see "Waiting on response" and "Resolving" repeated twice in the console/*@client(() => { return <div>Loading...</div>}) */
@resolve({"user": function(props){console.log("Waiting on response, ",props);returnnewPromise((resolve,reject)=>{setTimeout(()=>{console.log("Resolving");resolve("ayyyyyy");},5000)})}})exportdefaultclassInnerSearchPageextendsSearchPage{};
Expected Output
[with or without server side rendering, eg, React Router switching pages. This is the observed behavior without @client(...)]
Waiting on response, Object { [abridged] }
Resolving
USER PROP: ayyyyyy
Actual Output
[with or without server side rendering]
Waiting on response, Object { [abridged] }
Resolving
USER PROP: ayyyyyy
Waiting on response, Object { [abridged] }
Resolving
USER PROP: ayyyyyy
Notes
I'm using server-side rendering, but the behavior is unchanged when I remove window.__REACT_RESOLVER_PAYLOAD__.
I am using HOC as a parent of this component.
Some Versions. I don't know how much of this is relevant.
I am actually having a similar problems. I am making an isomorphic react. I use the window.REACT_RESOLVER_PAYLOAD
The observation is:
the first time I do server rendering, then the first client rendering fetch the data from window.REACT_RESOLVER_PAYLOAD
I get the @resolve({ user })called every-time on navigation on and using client rendering. It looks like the user data get's lost. I never changed the data from the user, and I passed it to the children as props for an header, footer and mainPage component,s and then as context for children component inside mainPage.
I will tell you if I succeed to find out what the issue is.
Reproduction test case
Expected Output
[with or without server side rendering, eg, React Router switching pages. This is the observed behavior without
@client(...)
]Actual Output
[with or without server side rendering]
Notes
I'm using server-side rendering, but the behavior is unchanged when I remove
window.__REACT_RESOLVER_PAYLOAD__
.I am using HOC as a parent of this component.
Some Versions. I don't know how much of this is relevant.
The text was updated successfully, but these errors were encountered: