Skip to content

Commit

Permalink
fix: prevent showing not matching history (#3420)
Browse files Browse the repository at this point in the history
We show all history at the moment even when path is changed. Here
improved logic to exclude all paths from history not matching current
page path pattern.

<img width="266" alt="image"
src="https://github.com/webstudio-is/webstudio/assets/5635476/ef4c5b39-fe61-44f8-8e10-580247b378b2">
  • Loading branch information
TrySound authored May 25, 2024
1 parent c621ce9 commit bf251b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/builder/app/builder/features/address-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { mergeRefs } from "@react-aria/utils";
import {
forwardRef,
useEffect,
useMemo,
useRef,
useState,
type ComponentProps,
Expand Down Expand Up @@ -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() ?? {}
);
Expand Down

0 comments on commit bf251b5

Please sign in to comment.