These are chat archives for redfin/react-server

14th
Jun 2016
Perry Shuman
@Noirbot
Jun 14 2016 01:01
Is there a particular way we should load JSON files in React Server?
I'm trying to use
const data = require('json!./data/data.json');
And it seems to be failing to find the file
But that seems to be the canonical way to load it within webpack
Sasha Aickin
@aickin
Jun 14 2016 16:04
@Noirbot do you have json-loader installed?
(I've never tried this particular use case, but it's not obvious to me why it should fail)
Sasha Aickin
@aickin
Jun 14 2016 16:11
@doug-wade finally got around to reading the article on Rill (which was already in my stack). Really interesting, although I'm not 100% sure I entirely understand it.
I like the idea that Rill uses raw Node HTTP routing, which maybe makes it easier to plug in different routers (?)
I've been musing recently that some of react-server's features are not even really specific to react, but in theory could be used by any isomorphic library. Things like streaming out root elements, pages knowing their sub-assets, the RSA cache, client transitions, and late arrivals.
Sasha Aickin
@aickin
Jun 14 2016 20:56
fyi, evidently we are going live in a Hangout on Air in a few minutes. didn't realize it was live! https://twitter.com/React30/status/742476806935060480
Bo Borgerson
@gigabo
Jun 14 2016 21:00
Awesome!
Break a leg! :D
Sasha Aickin
@aickin
Jun 14 2016 21:36
Done!
Bo Borgerson
@gigabo
Jun 14 2016 21:36
That was cool!
Sasha Aickin
@aickin
Jun 14 2016 21:39
hopefully I didn't say anything too incorrect
:grimacing:
Bo Borgerson
@gigabo
Jun 14 2016 21:39
Well... ;)
Sasha Aickin
@aickin
Jun 14 2016 21:40
uh oh
Bo Borgerson
@gigabo
Jun 14 2016 21:40
There's no synchronous render timeout anymore, but that didn't detract from your awesome explanation of late data arrival.
Sasha Aickin
@aickin
Jun 14 2016 21:40
d'oh! sorry about that
it was a lil stressful knowing I only had like 4 minutes
Bo Borgerson
@gigabo
Jun 14 2016 21:43
Man, it would be cool if we could figure out a way for react-server and react-router to play well together...
Sasha Aickin
@aickin
Jun 14 2016 21:43
we talked about that a little bit after we went off air
and they basically said, "yeah, it's not really designed for what you are doing..."
in a really humble way
Douglas Wade
@doug-wade
Jun 14 2016 21:44
Have you gotten react-dom-stream and react-server to play nice?
Sasha Aickin
@aickin
Jun 14 2016 21:44
no, but mostly because I haven't tried. ;)
react-dom-stream is React 14 only, and I'm concentrating my firepower on getting it in to core React
Bo Borgerson
@gigabo
Jun 14 2016 21:45
I hadn't thought about the checksum issue. The self-removing script tag is clever. :)
That could mess with us in react-server, though, since it will force a paint.
Don't want that above the fold.
Sasha Aickin
@aickin
Jun 14 2016 21:46
the first version returned the checksum as well as the stream and you had to manually add the checksum to the dom before calling ReactDOM.render() on the client
and then I figured out the self-removing script tag
Bo Borgerson
@gigabo
Jun 14 2016 21:46
That's what we would need, I think.
Sasha Aickin
@aickin
Jun 14 2016 21:46
why would it force a paint?
gigabo @gigabo trying to track down a source for that...
gigabo @gigabo not having much luck. :grimacing:
Bo Borgerson
@gigabo
Jun 14 2016 21:50
That's what we ran into when we started trying to time when root elements are visible in the browser.
Sasha Aickin
@aickin
Jun 14 2016 21:50
I'd be very interested to read about that, so please forward along if you do happen to find it
Bo Borgerson
@gigabo
Jun 14 2016 21:51
We wanted to put basically <script>rootTimings[<elementIndex>] = new Date</script> after each root element.
But that turned out to force a paint between root elements.
Sasha Aickin
@aickin
Jun 14 2016 21:52
hmmmmmmmmm
if I change the client side too, I could put the checksum in a comment node after the render
and have the client side look either in an attribute or in the sibling comment node
that would be a lot less hokey than the self-removing script tag and less likely to cause odd side effects of painting
thoughts?
Bo Borgerson
@gigabo
Jun 14 2016 21:56
Seems in-line with react 15's move to comment nodes around text, too.
Sasha Aickin
@aickin
Jun 14 2016 22:01
That's a good idea, and has the benefit of deleting a bunch of code. Thanks, @gigabo!
Bo Borgerson
@gigabo
Jun 14 2016 22:02
:tada: