From 269d60c32b8b05d9ef49a43d41792e17cff4022f Mon Sep 17 00:00:00 2001 From: Blankeos Date: Thu, 19 Dec 2024 23:06:51 +0800 Subject: [PATCH] fix: state persistence across new layout navigations. --- packages/vike-solid/integration/getPageElement.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/vike-solid/integration/getPageElement.tsx b/packages/vike-solid/integration/getPageElement.tsx index 63b775f..98d3188 100644 --- a/packages/vike-solid/integration/getPageElement.tsx +++ b/packages/vike-solid/integration/getPageElement.tsx @@ -28,12 +28,12 @@ function Wrapper(props: { children: JSX.Element }) { ...(pageContext.config.Layout || []), // Outer wrapping ...(pageContext.config.Wrapper || []), - ]), + ].reverse()), ); }); const renderWrappers = (i: number = 0) => { - let item = wrappers.at(-(i + 1)); + let item = wrappers[i]; // Assumes reversed, and must access with `[i]` instead of `.at(i)` otherwise, wrapper's states are not persisted. if (!item) return props.children;