@@ -27,9 +27,7 @@ import {
27
27
ROOT_FOLDER_ID ,
28
28
findParentFolderByChildId ,
29
29
ProjectNewRedirectPath ,
30
- DataSource ,
31
30
isLiteralExpression ,
32
- type System ,
33
31
documentTypes ,
34
32
isRootFolder ,
35
33
} from "@webstudio-is/sdk" ;
@@ -74,7 +72,6 @@ import {
74
72
$instances ,
75
73
$pages ,
76
74
$dataSources ,
77
- $dataSourceVariables ,
78
75
$publishedOrigin ,
79
76
$project ,
80
77
$userPlanFeatures ,
@@ -112,6 +109,7 @@ import { useUnmount } from "~/shared/hook-utils/use-mount";
112
109
import { Card } from "../marketplace/card" ;
113
110
import { selectInstance } from "~/shared/awareness" ;
114
111
import { computeExpression } from "~/shared/data-variables" ;
112
+ import { $currentSystem } from "~/shared/system" ;
115
113
116
114
const fieldDefaultValues = {
117
115
name : "Untitled" ,
@@ -579,7 +577,7 @@ const LanguageField = ({
579
577
) ;
580
578
} ;
581
579
582
- const usePageUrl = ( values : Values , systemDataSourceId ?: DataSource [ "id" ] ) => {
580
+ const usePageUrl = ( values : Values ) => {
583
581
const pages = useStore ( $pages ) ;
584
582
const foldersPath =
585
583
pages === undefined ? "" : getPagePath ( values . parentFolderId , pages ) ;
@@ -588,16 +586,10 @@ const usePageUrl = (values: Values, systemDataSourceId?: DataSource["id"]) => {
588
586
. join ( "/" )
589
587
. replace ( / \/ + / g, "/" ) ;
590
588
591
- const dataSourceVariables = useStore ( $dataSourceVariables ) ;
592
- const storedSystem =
593
- systemDataSourceId === undefined
594
- ? undefined
595
- : ( dataSourceVariables . get ( systemDataSourceId ) as System ) ;
596
- const pathParams = storedSystem ?. params ?? { } ;
597
-
589
+ const system = useStore ( $currentSystem ) ;
598
590
const publishedOrigin = useStore ( $publishedOrigin ) ;
599
591
const tokens = tokenizePathnamePattern ( path ) ;
600
- const compiledPath = compilePathnamePattern ( tokens , pathParams ) ;
592
+ const compiledPath = compilePathnamePattern ( tokens , system . params ) ;
601
593
return `${ publishedOrigin } ${ compiledPath } ` ;
602
594
} ;
603
595
@@ -705,13 +697,11 @@ const MarketplaceSection = ({
705
697
} ;
706
698
707
699
const FormFields = ( {
708
- systemDataSourceId,
709
700
autoSelect,
710
701
errors,
711
702
values,
712
703
onChange,
713
704
} : {
714
- systemDataSourceId ?: DataSource [ "id" ] ;
715
705
autoSelect ?: boolean ;
716
706
errors : Errors ;
717
707
values : Values ;
@@ -724,7 +714,7 @@ const FormFields = ({
724
714
const { allowDynamicData } = useStore ( $userPlanFeatures ) ;
725
715
const { variableValues, scope, aliases } = useStore ( $pageRootScope ) ;
726
716
727
- const pageUrl = usePageUrl ( values , systemDataSourceId ) ;
717
+ const pageUrl = usePageUrl ( values ) ;
728
718
729
719
if ( pages === undefined ) {
730
720
return ;
@@ -1656,12 +1646,7 @@ export const PageSettings = ({
1656
1646
}
1657
1647
} }
1658
1648
>
1659
- < FormFields
1660
- systemDataSourceId = { page . systemDataSourceId }
1661
- errors = { errors }
1662
- values = { values }
1663
- onChange = { handleChange }
1664
- />
1649
+ < FormFields errors = { errors } values = { values } onChange = { handleChange } />
1665
1650
</ PageSettingsView >
1666
1651
) ;
1667
1652
} ;
0 commit comments