Comments (17)
š examples.microsite.page is live! I'm going to leave this issue open until #94 is merged into main
, but the examples are working and setup with Vercel's CI.
from microsite.
@eyelidlessness Thanks! I actually got these examples mostly working tonight... Need to fix a few things on the deployment side but that should be fairly quick to do tomorrow.
from microsite.
@natemoo-re Awesome!!
I will say and I hope Iām not being too intrusive, this is why I put so much effort into testing before trying to dig into fixes. Iāve been super worried about breaking stuff but a good or even growing test suite could help alert me before Iāve done something unsuspecting. I know you know this but Iām mentioning it here because I want to double down on my intention to contribute and to be sure Iām not breaking some other poor soulās site
from microsite.
@eyelidlessness not being intrusive at all! The help is so appreciated! I'm hoping to wrap up the testing piece by the weekend so we can move a little faster without the fear of breaking everything.
from microsite.
I pushed a number of changes in #94 to fix the examplesāthe examples themselves seem to be broken at the moment, but I'm investigating that. But the build process is all fixed and will live on https://examples.microsite.page soon!
from microsite.
I have been meaning to look into doing full document mount with noop
components! I think that would be the next technique to explore, which would hopefully add back full support for context Providers.
The Fragment
thing actually turned out to be a quick fix, with some help from the Preact team!
from microsite.
@natemoo-re Iāve looked into this but if youāre gonna get to it before me, I have a few observations:
-
None of the sites build without lerna hoist; side note Iāll look at PNPM or otherwise recommend a Yarn solution after all because yarn with workspaces configuration definitely doesnāt muck this up.
-
That said the hoist behavior is generally not good to rely on and shared dependencies may be better off optional/peer.
-
The Tailwind example is missing a PostCSS dependency and fails no matter what.
I wanted to look into this deeper today but I was still trying to land my first site build. Iāll look as soon as I can but wanted to share what Iāve seen.
from microsite.
Oof I forgot to mention the most important local debugging thing: lerna too often fails with a success exit, and swallows error logs. I tack on a --stream
flag on every lerna command to ensure I see everything. Otherwise building the examples locally (for example) fails with no error
from microsite.
@natemoo-re oh that would be so great! For what itās worth Iām a breath away from putting a little teaser up on my site and Iām gonna shout out this project for helping me get it built. Iām really hoping I can get it there tomorrow.
from microsite.
@natemoo-re thank you! I love the idea of the project because I've been carrying the same idea for a few years :)
I haven't started to dig into the problem deeper because haven't found any contribution recommendations. I would like to help but don't know how it works for this project :)
It could be great to have any kind of manual for new folk who want help.
from microsite.
@natemoo-re nice to see them back up!
I hate to be the bearer of bad news, but the partial hydration example seems to have the same affliction I experienced yesterday: flaky hydration.
Iām not sure what was the culprit for me but I experienced it moving from my spike project into my main site. The solve for me was to literally copy over my lockfile and reinstall. But this does mean thereās some dependency with unexpected breaking changes.
from microsite.
@eyelidlessness Yep, I saw that. The culprit seems to be some tweaks to hydration logic in [email protected]
and up. I pinned Microsite's version of preact
to exactly [email protected]
in v1.1.0-next.5
, so make your lockfiles are fresh.
Also reached out on the Preact Slack for some help to see if it's a regression or Microsite needs to update some logic.
To be fair, Microsite's hydration logic uses an interesting technique to support mounting components with Fragment roots, which I imagine is fairly uncommon.
from microsite.
Yeah I definitely imagine Microsite being subject to more unexpected breaking changes than youād normally expect. Iām glad you identified the problem!
Interestingly what I saw on my site is slightly different:
-
hydrating on idle consistently caused the component to mount as expected and then immediately unmount (which I see at least on mobile for either hydration case on your example)
-
hydrating on visible caused hydration to sometimes not occur at all/immediately unmount, sometimes occur adjacent to the server rendered node, and sometimes function normally
I strongly suspect thereās some timing factor involved here. But I was in build mode so I didnāt get hung up on it once I brute forced a fix
from microsite.
To be fair, Microsite's hydration logic uses an interesting technique to support mounting components with Fragment roots, which I imagine is fairly uncommon.
Before I found Microsite and was considering other solutions or even just rolling my own, I was thinking about going with a full document mount but substituting static components with a noop with shouldComponentUpdate
always returning false. I have no idea if it would work but if it did it might be more reliable than fragment mounts (which I super appreciate because they donāt break styles the way other hydration marker approaches do).
Another harebrained scheme I considered was rendering all hydrated components as custom elements (and even just using that as the distinction between static/interactive), which also might be a possible mount point.
Not trying to monkeywrench whatās already working if the current approach is easy to fix with the Preact update but thought this would be a good place to drop those thoughts in case theyāre helpful.
from microsite.
which would hopefully add back full support for context Providers
Iām assuming this is because thereās multiple mount points? Iāve also thought this might be solvable with one full page noop and Portal
s, but every time I go read the docs I get hung up on the DOM nonsense and bail.
from microsite.
Right, multiple mount points means there are multiple instances of Preact running. Each hydration point is its own app. While Providers technically work, they don't stay in sync across Preact instances for obvious reasons.
from microsite.
Hi, I tried to use it with the current version and it's working. Will, there be an example for current version?
from microsite.
Related Issues (20)
- Remove defer from inline scripts HOT 3
- Move `microsite-templates` into this repo HOT 1
- Doesn't do the thing š HOT 3
- Partial hydration causes Preact to be fetched twice HOT 10
- production build fails when CSS module is imported on multiple pages HOT 2
- getStaticProps + node builtins + dev server fails HOT 1
- Preact import regex matches too much HOT 2
- Preact CDN lookup fails for non-hardcoded submodules HOT 1
- Enhancement: Support SSR-able components as props for hydrated components HOT 7
- getStaticPaths uses moduleās path when returning params object HOT 1
- [RFC] Built-in Markdown/MDX Support HOT 2
- Dynamic routes won't work in dev mode HOT 4
- Hydrated component isn't initialized in prod builds when it is exported/imported under a name different from the name of the component it decorates HOT 6
- Make withHydrate a no-op when nested rather than an error
- Hydration fails with nested props arrays/objects HOT 7
- Build fails with "Error: You must supply options.input to rollup"
- import.meta.env.SSR is true on the client HOT 1
- Preact modules are loaded with `modulepreload` even if they're not used
- dev server fails to load fetch HOT 1
- Add SCSS/SASS support?
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 microsite.