These are chat archives for ractivejs/ractive

28th
Jan 2018
Paul Maly
@PaulMaly_twitter
Jan 28 2018 00:00
@MartinKolarik right, but you talking about the homepage, so it's out of rules - url couldn't represent always the same content and changing in time very quikly. But how about other pages, e.g. article page or something.
Martin Kolárik
@MartinKolarik
Jan 28 2018 00:01
my first point applies to articles
Paul Maly
@PaulMaly_twitter
Jan 28 2018 00:01
If you content or code was changed you always able to send right http header to drop browser cache
Martin Kolárik
@MartinKolarik
Jan 28 2018 00:02
you can't send an http header when a browser doesn't make a request
in theory a combination of If-Modified-Sinceand 304 Not Modified could work
but that would be harder to implement correctly and still not solve the problem that people usually don't visit the same page more than once
Paul Maly
@PaulMaly_twitter
Jan 28 2018 00:07

you can't send an http header when a browser doesn't make a request

Why browser shouldn't make a request?

Chris Reeves
@evs-chris
Jan 28 2018 00:08
usually, if the browser has cache that's not out of date, it skips the network entirely and just pulls from disk
Martin Kolárik
@MartinKolarik
Jan 28 2018 00:08
because you told it not to make it?
as I said, you could solve that by sending must-revalidate and then responding with 304 when user's cache is up to date, but that's too complicated already
Paul Maly
@PaulMaly_twitter
Jan 28 2018 00:10
Nope, I didn't))
Browser will send a request with If-Modified-Since to check
And server need to decide response 304 or not

as I said, you could solve that by sending must-revalidate and then responding with 304 when user's cache is up to date, but that's too complicated already

yep, actually, not so hard, but not so simple. I didn't even say that it would simple

Paul Maly
@PaulMaly_twitter
Jan 28 2018 00:16
I've told right using of http headers to control that?

still not solve the problem that people usually don't visit the same page more than once

Why? For example settings-page, someone profile-page or other project-specific pages. There's lot of pages which could be cached in safe manner, I guess.

Paul Maly
@PaulMaly_twitter
Jan 28 2018 00:21
Of course, not all pages, very interactive pages still very hard to invalidate when caching them. So probably these are an exceptions.
Martin Kolárik
@MartinKolarik
Jan 28 2018 00:24
I guess you are right
Paul Maly
@PaulMaly_twitter
Jan 28 2018 00:29
Most simple workflow, for example, article page:
  • browser will send you GET /article/:slug with If-Modified-Since <date>
  • server code looks at db fieldupdated_at <date>(or something) of current article and matches with header
  • if wasn't modified since then sends 304, else 200 Ok
Not so hard in this case
Juan C. Andreu
@andreujuanc
Jan 28 2018 14:47
Why all the nice convos happen when i'm sleeping xD (UTC +1 and married)
I got my SSR working now. I just don't know if i should render with real data, or some placeholder to do the App Shell kinda thing.
Juan C. Andreu
@andreujuanc
Jan 28 2018 15:22
still dont know how to hydrate the nodes
they just get replaced :(((
Paul Maly
@PaulMaly_twitter
Jan 28 2018 15:25
enhance: true?
Juan C. Andreu
@andreujuanc
Jan 28 2018 15:32
is it default to false?
Paul Maly
@PaulMaly_twitter
Jan 28 2018 15:32
Yep
Juan C. Andreu
@andreujuanc
Jan 28 2018 15:32
AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
BRB
Paul Maly
@PaulMaly_twitter
Jan 28 2018 15:32
Make sure append: false
Juan C. Andreu
@andreujuanc
Jan 28 2018 15:36
as i remember that one also defaults to false
im testing this :3
whats the best way to make sure that nodes are being reused?
blinking on dev tools ? D:
Juan C. Andreu
@andreujuanc
Jan 28 2018 15:46
Progressive Enhancement
TODO
:'(
Paul Maly
@PaulMaly_twitter
Jan 28 2018 15:54
?
Juan C. Andreu
@andreujuanc
Jan 28 2018 15:54
Nah, its just not working :(
Ill leave it for now.
Paul Maly
@PaulMaly_twitter
Jan 28 2018 15:55
Why you think so?
Progressive Enhancement
TODO
That mean the docs need to be improved in this part
Chris Reeves
@evs-chris
Jan 28 2018 16:12
progressive enhancement should be working... at the very least, the test suite passes
the target html has to match exactly though, it it will touch nodes
and it will pretty much always touch text nodes to split them up for interpolators, but that shouldn't cause any flashing
Joseph
@fskreuz
Jan 28 2018 16:15
I don't have that much under-the-hood knowledge to extensively document how Ractive reuses already-rendered HTML. 90% of Ractive still looks like sorcery to me. The 10% is probably adaptors and CSS, but even that is just superficial. :smile:
Joseph
@fskreuz
Jan 28 2018 16:21
Even a 10,000ft overview would be great, like this one for React https://calendar.perfplanet.com/2013/diff/ whose tl;dr is "given new state, either reuse tree or re-render tree" and "given same key, it's the same thing".
Chris Reeves
@evs-chris
Jan 28 2018 16:23
it's not too awful... when elements (vdom) are rendered, they are passed an array of nodes from their parent element (dom) and will try to find one to take over from that list (occupants) discarding ones that don't match along the way. If no match I'd found, a new node (dom) is created to be used as usual.
I didn't realize there was a todo in the docs for that. I'll see if I can't get the overview added
I'd->is
because Gboard is a little too clever
Joseph
@fskreuz
Jan 28 2018 16:25
:D
Chris Reeves
@evs-chris
Jan 28 2018 16:25
and bless gitter, there's no editing in the mobile app
Chris Reeves
@evs-chris
Jan 28 2018 16:45
here's an enhance example, and the update indicator on the nodes that are reused is usually due to the text inside them getting touched, especially for whitespace mismatches, which are really hard to resolve
Paul Maly
@PaulMaly_twitter
Jan 28 2018 16:47
:+1: