Comments (10)
@gilesbradshaw Yes, I can work up a solution for you on this.
from react-resolver.
I am a little confused. The server has rendered the markup - having made the asynchronous call. The client then also makes the asynchronous call - after having done it's render. Surely the point is that the call has been made on the server so it doesn't need to be re made by the client? Ie the client should just accept the markup from the server.
from react-resolver.
my project is here btw - wld be grateful if you could have a look!
https://github.com/gilesbradshaw/react-flummox
http://localhost:7000/app2 brings up the warning + does async calls on both server + client
from react-resolver.
@gilesbradshaw we’ve been using this PR for all of our isomorphic projects of late: #34
Basically, you have to tell react-resolver that the call has already been made and put that data into memory (not just into markup).
from react-resolver.
I wish I understood that @iamdustan - could you very kindly explain further?
from react-resolver.
I have made a script on the serer which says
<script async>var __resolver__ = {".0":{"fulfilled":true,"rejected":false,"values":{}},".0.0":{"fulfilled":true,"rejected":false,"values":{"linkName":"APPPPPP","link":"app1","list":[{"id":0,"content":"ahhhh"}]}}};</script><script src="http://localhost:7001/assets/main-33d5ca2650f97c3b76c5.js"></script><script src="http://localhost:7001/assets/0.7bb83fb274f8d7d75a21.hot-update.js"></script>
now I need to rehydrate that on the client not sure how though! :)
from react-resolver.
@gilesbradshaw Sorry this isn't public API yet!
You can instantiate a const hydratedResolver = new Resolver(window.__resolver__)
on the client;
react-resolver/src/Resolver.js
Lines 7 to 11 in 0aa36af
And pass it in to Resolver.render
via:
Resolver.render(<Handler />, document.getElementById("app"), hydratedResolver);
react-resolver/src/Resolver.js
Lines 161 to 169 in 0aa36af
That should work!
from react-resolver.
got it! - actually I just did new Resolver(0 - it defaults to resolver at least in what I have - but passing resolver (or whatever) to Resolver makes sense.
Really pleased about that :)
I assume now resolver can be the whole tree of fetched data from the server. + also hopefully some of the data can not be fetched on the server and would then be fetched by the client.
from react-resolver.
@gilesbradshaw Right. When rendering on the server, you should be able to do something like window.__resolver__ = JSON.stringify(resolver.states);
to get the history.
Whatever comes back is all that's necessary to recreate the entire tree for initial load, then work as normal thereafter!
from react-resolver.
Alright, so this is entirely solved in v2. Closing in favor of that...
from react-resolver.
Related Issues (20)
- React.renderToStaticMarkup -> ReactDOMServer.renderToStaticMarkup HOT 2
- Can I use this without server rendering? HOT 3
- Add ability to cache resolved props HOT 9
- Using HOC breaks HMR
- Minimum universal react API HOT 1
- test
- Support variable? HOT 3
- Unhandled rejections server side HOT 1
- @context steals data from this.context HOT 6
- Allow factory to decide which props to re-use? HOT 5
- Documentation links are broken HOT 4
- Using same component on different routes HOT 3
- Using @client and @resolve on the same class causes @resolve to be called twice HOT 1
- Some way of manipulating data before passing it to component HOT 2
- Breakage with React 16: PropTypes no longer exported by React HOT 1
- "[email protected]" has incorrect peer dependency "react@^0.14.6 || ^15.0.0-0" HOT 5
- Need hydrate static method in the Resolver class for server side rendering HOT 2
- Fix compatibility with Babel 6
- Resolve multiple props with one callback HOT 5
- Initial Data from Django using React Resolver HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-resolver.