Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: prevent showing not matching history (#3420)

Bogdan Chadkinbf251b5f85d2
diff --git a/apps/builder/app/builder/features/address-bar.tsx b/apps/builder/app/builder/features/address-bar.tsx
index e33113e2ec..6c1f715280 100644
--- a/apps/builder/app/builder/features/address-bar.tsx
+++ b/apps/builder/app/builder/features/address-bar.tsx
@@ -4,6 +4,7 @@ import { mergeRefs } from "@react-aria/utils";
import {
forwardRef,
useEffect,
+ useMemo,
useRef,
useState,
type ComponentProps,
@@ -273,7 +274,10 @@ const AddressBar = forwardRef<
>(({ onSubmit }, ref) => {
const publishedOrigin = useStore($publishedOrigin);
const path = useStore($selectedPagePath);
- const history = useStore($selectedPageHistory);
+ let history = useStore($selectedPageHistory);
+ history = useMemo(() => {
+ return history.filter((item) => matchPathnamePattern(path, item));
+ }, [history, path]);
const [pathParams, setPathParams] = useState(
() => $selectedPagePathParams.get() ?? {}
);