Skip to content

Commit e6a074d

Browse files
committed
test(vite-rsc-demo): drop loading() from the product detail route
The route-level loading() boundary made every same-route re-render swap the whole product page for the skeleton — visibly on ?tab= navigations, where the handler re-runs to render the other tab while BOTH loaders and the route predicate are revalidate-false (nothing refetches; only the content promise is fresh). Without loading() the commit holds the current content until the new tab's content is ready — no flash. This is the recommended shape under read-site useLoader suspension: inline Suspense at actual data reads, transition() for animated holds, route-level loading() reserved for a deliberate first-paint skeleton.
1 parent cf452b9 commit e6a074d

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎tests/vite-rsc-demo/src/urls/shop.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import {
3434
RecentOrders,
3535
} from "../handlers/shop/components.js";
3636
import {
37-
ProductDetailSkeleton,
3837
CartSkeleton,
3938
CheckoutSkeleton,
4039
} from "../handlers/shop/components/loading.js";
@@ -187,7 +186,14 @@ export const shopPatterns = urls(
187186
ProductDetailRouteWithBreadcrumbs,
188187
{ name: "products.detail.view" },
189188
() => [
190-
loading(<ProductDetailSkeleton />, { ssr: true }),
189+
// loading() dropped deliberately: the route-level boundary made
190+
// every same-route re-render (the ?tab= navs — handler re-runs,
191+
// loaders all revalidate-false) swap the whole page for the
192+
// skeleton. Without it the commit holds current content until the
193+
// new tab's content is ready. First document paint now waits for
194+
// the handler instead of showing <ProductDetailSkeleton />; put
195+
// inline <Suspense> around actual data reads if a skeleton is
196+
// wanted there.
191197
loader(ProductLoader, () => [revalidate(() => false), cache()]),
192198
loader(RelatedProductsLoader, () => [revalidate(() => false)]),
193199
revalidate(productDetailRevalidation),

0 commit comments

Comments
 (0)