-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
💡 RFC: Add support for client-side only component hydration #751
Comments
|
Copying from discussion on Discord: https://discord.com/channels/830184174198718474/845430950191038464/865646524734111784
Not sure how feasible this is (i don't think it is, actually) but the idea of providing a placeholder/fallback via a slot is interesting! |
@FredKSchott you wrote |
Use Case
RFC Discussion
Does this work without fallback support?
RFC Decision
|
We should make sure this will work with #877. I'm guessing support for combining hydration methods will be generic so |
@tony-sull Good point. That brings up, when should |
Maybe it shouldn't specify a loading strategy, though in effect the default would be on :load.. so you need to do both client:only and client:visible? |
Yeah I hadn't thought at all about combining hydration modes until I noticed #877 in the RFC tracker. I also was thinking |
Regardless, I think these are questions for #877 to answer, it shouldn't block |
Co-authored-by: tony-sull <tony-sull@users.noreply.github.com> Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
Background & Motivation
I want to be able to mark a component to only hydrate in the browser
Proposed Solution
<Counter client:only />
Possible solutions
<Counter client:only />
Alternatives considered
Wrapping browser - specific calls in
import.meta.env.SSR
or undefined checksRisks, downsides, and/or tradeoffs
Will likely run into #642 since the children wouldn't be included in the server rendered DOM
Open Questions
Is there an easier way to allow this without partial hydration? Would something like
Astro.props.browser
do the trick?Detailed Design
During SSR, any component with
client:only
hydration won't be rendered but will be prepped for client-side hydration as usual.Good warnings are key here! If a component fails to render during SSR, log a good error message and recommend using
client:only
if the component depends on browser-specific APIsHelp make it happen!
The text was updated successfully, but these errors were encountered: