mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(site): remove unnecessary hydration workarounds
This commit is contained in:
@@ -3,9 +3,15 @@ import type { SupportedFramework } from '@/types/docs';
|
||||
|
||||
interface Props {
|
||||
frameworks?: SupportedFramework[];
|
||||
/**
|
||||
* I'm running into some crazy problems with hydration.
|
||||
* Putting client:load in one of these conditionals causes Astro to just give up hydrating the whole app for some reason.
|
||||
* If you're running into that, too, this prop may be for you.
|
||||
*/
|
||||
withHydrationWorkaround?: boolean;
|
||||
}
|
||||
|
||||
const { frameworks } = Astro.props;
|
||||
const { frameworks, withHydrationWorkaround } = Astro.props;
|
||||
const { framework } = Astro.params;
|
||||
|
||||
// Only render if current framework matches, or if no frameworks specified (all frameworks)
|
||||
@@ -13,19 +19,11 @@ const shouldRender = !frameworks || frameworks.includes(framework as SupportedFr
|
||||
---
|
||||
|
||||
{
|
||||
/*
|
||||
What I WANT to do is
|
||||
```
|
||||
{shouldRender && <slot />}
|
||||
```
|
||||
|
||||
But I'm running into some crazy problems with hydration.
|
||||
Putting client:load in one of these conditionals causes Astro to just give up hydrating the whole app for some reason.
|
||||
TODO: fix this
|
||||
|
||||
So, while I debug those... let's do this
|
||||
*/
|
||||
withHydrationWorkaround ? (
|
||||
<div class="contents" hidden={!shouldRender}>
|
||||
<slot />
|
||||
</div>
|
||||
) : (
|
||||
shouldRender && <slot />
|
||||
)
|
||||
}
|
||||
<div class="contents" hidden={!shouldRender}>
|
||||
<slot />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user