Browse Source

[Beta] Enable Selective Hydration in more places (#4689)

* [Beta] Enable Selective Hydration in more places

* Fix typo
main
dan 3 years ago
committed by GitHub
parent
commit
47eea56bcf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      beta/src/components/Layout/Nav/MobileNav.tsx
  2. 17
      beta/src/components/Layout/Page.tsx
  3. 5
      beta/src/components/Layout/Sidebar/Sidebar.tsx

5
beta/src/components/Layout/Nav/MobileNav.tsx

@ -57,7 +57,10 @@ export function MobileNav() {
API API
</TabButton> </TabButton>
</div> </div>
<SidebarRouteTree routeTree={tree as RouteItem} isMobile={true} /> {/* No fallback UI so need to be careful not to suspend directly inside. */}
<React.Suspense fallback={null}>
<SidebarRouteTree routeTree={tree as RouteItem} isMobile={true} />
</React.Suspense>
</> </>
); );
} }

17
beta/src/components/Layout/Page.tsx

@ -26,14 +26,17 @@ export function Page({routeTree, children}: PageProps) {
<Sidebar /> <Sidebar />
</div> </div>
<div className="flex flex-1 w-full h-full self-stretch"> {/* No fallback UI so need to be careful not to suspend directly inside. */}
<div className="w-full min-w-0"> <React.Suspense fallback={null}>
<main className="flex flex-1 self-stretch mt-16 sm:mt-10 flex-col items-end justify-around"> <div className="flex flex-1 w-full h-full self-stretch">
{children} <div className="w-full min-w-0">
<Footer /> <main className="flex flex-1 self-stretch mt-16 sm:mt-10 flex-col items-end justify-around">
</main> {children}
<Footer />
</main>
</div>
</div> </div>
</div> </React.Suspense>
</div> </div>
</SidebarContext.Provider> </SidebarContext.Provider>
</MenuProvider> </MenuProvider>

5
beta/src/components/Layout/Sidebar/Sidebar.tsx

@ -42,7 +42,10 @@ export function Sidebar() {
{isMobileSidebar ? ( {isMobileSidebar ? (
<MobileNav /> <MobileNav />
) : ( ) : (
<SidebarRouteTree routeTree={routeTree} /> /* No fallback UI so need to be careful not to suspend directly inside. */
<React.Suspense fallback={null}>
<SidebarRouteTree routeTree={routeTree} />
</React.Suspense>
)} )}
</nav> </nav>
<div className="sticky bottom-0 hidden lg:block"> <div className="sticky bottom-0 hidden lg:block">

Loading…
Cancel
Save