Doug Parker · @develwithoutacause
241 followers · 991 posts · Server techhub.social

Are there any good conferences / meetups with an open in the or virtual?

There are a few projects I've been working on which I'd love to give talks about and share with the community (not Angular related). Could be talking about any/all of:

1. - A different take on hydration in an HTML-first world. github.com/dgp1130/HydroActive
2. - A ruleset serving as a fast and scalable . github.com/dgp1130/rules_prere
3. - A no-tooling, web standard-based approach to HTML over the wire. blog.dwac.dev/posts/html-fragm

Greatly appreciate boosts for reach!

#web #rfp #bayarea #hydroactive #rules_prerender #bazel #staticsitegenerator #htmlfragments

Last updated 2 years ago

Doug Parker · @develwithoutacause
182 followers · 423 posts · Server techhub.social

@tbroyer Thanks for sharing that. I'd heard of the approach but don't think I'd read that article specifically. The performance metrics are very interesting.

I think the difference is that routing is technically an approach and keeps context between routes in a way that a navigation would not.

HTML Fragments as a concept is also a little more flexible beyond rendering full pages. It allows you to dynamically render individual components instead of a full page. For example, you can use it to infinite scroll a list, or edit an item of the list and rerender on the server without invalidating the whole page. This is discussed more in the original post:

blog.dwac.dev/posts/html-fragm

For a fully static site with a lot of content, I think the service worker approach could work well, while HTML fragments provides a bit more interactivity.

#htmlfragments #spa #javascript #serviceworker

Last updated 3 years ago

Doug Parker · @develwithoutacause
182 followers · 423 posts · Server techhub.social

@jjude The routing demo is here:

github.com/dgp1130/html-fragme

And the original demo of a Twitter clone is here:

github.com/dgp1130/html-fragme

Which links are dead? The post is pretty new, so I would hope anything I referenced is still up, but maybe I typo-d something...

#htmlfragments

Last updated 3 years ago

Doug Parker · @develwithoutacause
182 followers · 423 posts · Server techhub.social

@tomayac 😁 I hadn't heard of "mini apps", I'll have to read more in that series, but the use of iframes sounds very similar. It reminds me a bit of the `embed` element I proposed here: blog.dwac.dev/posts/html-fragm

I imagine sandboxing would make those iframes tricky to work with in a lot of respects. With , at least everything is in the same frame and has the same JS execution context.

#htmlfragments

Last updated 3 years ago

Doug Parker · @develwithoutacause
180 followers · 407 posts · Server techhub.social

New blog post: Building a with .

blog.dwac.dev/posts/html-fragm

This explorers how we can use HTML fragments to define routes, load them dynamically, and then apply them to the main page content. It talks about more complexities with streaming (because I didn't learn my lesson last time) and even has a bonus section on shipping an application server _inside_ a .

Lots of interesting stuff, I hope you check it out!

#router #htmlfragments #html #serviceworker

Last updated 3 years ago

Doug Parker · @develwithoutacause
180 followers · 399 posts · Server techhub.social

So apparently is at least partially right here. `document.write()` implicitly resets the document meaning `document.body` gets reset to `null` and recreated when is parsed.

My mistake was observing the `document.body` _before_ the reset, so content streams into a _new_ `<body />` element I'm not observing.

The solution is to `document.open()` explicitly to reset the document early, _and then_ observe `document.body`. Subsequent `document.write()` calls will append to that `<body />` tag and trigger mutations.

There's still some weird divergences between Firefox and / which could probably be addressed, but I was able to make work at least.

github.com/dgp1130/html-fragme

Shout out to Olli Pettay for identifying the issue so quickly!

#firefox #html #Chrome #safari #htmlfragments

Last updated 3 years ago

Doug Parker · @develwithoutacause
179 followers · 394 posts · Server techhub.social

Playing around with streaming in and discovered my whole demo doesn't work because of one small Firefox bug: It doesn't trigger `MutationObserver` on `document.write()` for an inner document. 😭

bugzilla.mozilla.org/show_bug.

Hopefully it's something which can be fixed relative easily, but I'm worried it'll fall through the cracks as one of those "not that important because why would you ever do that" bugs.

#htmlfragments #firefox

Last updated 3 years ago

Doug Parker · @develwithoutacause
170 followers · 343 posts · Server techhub.social

Been playing around more with (blog post incoming soon) and I realized the streaming implementation is slower than it should be.

blog.dwac.dev/posts/streamable

If you stream two nodes with a delay between them, the first node actually won't stream at all! They'll both appear at once.

```html
response.write('<div id="1"></div>');
await timeout(1_000);
response.write('<div id="2"></div>');
```

This is because we use a `MutationObserver` and detect the addition of `#2` to know that `#1` is done parsing. However `#2` doesn't exist until 1 second after `#1` was sent. So in any realistic streaming scenario, the last element is displayed one batch later than it should.

#htmlfragments

Last updated 3 years ago