1+ import { useState , type ChangeEvent , useRef } from "react" ;
2+ import { flushSync } from "react-dom" ;
3+ import { useStore } from "@nanostores/react" ;
14import {
25 Grid ,
36 Flex ,
@@ -15,16 +18,14 @@ import {
1518 Tooltip ,
1619} from "@webstudio-is/design-system" ;
1720import { ArrowRightIcon , TrashIcon } from "@webstudio-is/icons" ;
18- import { useState , type ChangeEvent , useRef } from "react" ;
1921import {
2022 PagePath ,
2123 PageRedirect ,
2224 ProjectNewRedirectPath ,
2325} from "@webstudio-is/sdk" ;
24- import { useStore } from "@nanostores/react" ;
2526import { $pages , $publishedOrigin } from "~/shared/nano-states" ;
2627import { serverSyncStore } from "~/shared/sync" ;
27- import { flushSync } from "react-dom " ;
28+ import { matchPathnamePattern } from "~/builder/shared/url-pattern " ;
2829import { getExistingRoutePaths , sectionSpacing } from "./utils" ;
2930
3031export const SectionRedirects = ( ) => {
@@ -93,7 +94,13 @@ export const SectionRedirects = () => {
9394 }
9495
9596 if ( newPath . startsWith ( "/" ) === true ) {
96- if ( existingPaths . has ( newPath ) === false ) {
97+ let matched = false ;
98+ for ( const pattern of existingPaths ) {
99+ if ( matchPathnamePattern ( pattern , newPath ) ) {
100+ matched = true ;
101+ }
102+ }
103+ if ( matched === false ) {
97104 return [ "This path doesn't exist in the project" ] ;
98105 }
99106 }
0 commit comments