File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -171,6 +171,19 @@ function FieldLabelWrapperComponent(
171171 entryWorkflowStageDetails
172172 ) ;
173173
174+ const handleLinkVariant = ( ) => {
175+ if ( fieldSchema . field_metadata ?. canLinkVariant ) {
176+ visualBuilderPostMessage ?. send (
177+ VisualBuilderPostMessageEvents . OPEN_LINK_VARIANT_MODAL ,
178+ {
179+ contentTypeUid :
180+ props . fieldMetadata
181+ . content_type_uid ,
182+ }
183+ ) ;
184+ }
185+ } ;
186+
174187 const currentFieldDisplayName =
175188 displayNames ?. [ props . fieldMetadata . cslpValue ] ??
176189 fieldSchema . display_name ;
@@ -197,18 +210,7 @@ function FieldLabelWrapperComponent(
197210 . includes ( "click here to link a variant" ) && (
198211 < div
199212 className = { visualBuilderStyles ( ) [ "visual-builder__custom-tooltip" ] }
200- onClick = { ( ) => {
201- if ( fieldSchema . field_metadata ?. canLinkVariant ) {
202- visualBuilderPostMessage ?. send (
203- VisualBuilderPostMessageEvents . OPEN_LINK_VARIANT_MODAL ,
204- {
205- contentTypeUid :
206- props . fieldMetadata
207- . content_type_uid ,
208- }
209- ) ;
210- }
211- } }
213+ onClick = { handleLinkVariant }
212214 >
213215 { ( ( ) => {
214216 const [ before , after ] = reason . split (
Original file line number Diff line number Diff line change @@ -44,27 +44,6 @@ async function handleRevalidateFieldData(): Promise<void> {
4444 FieldSchemaMap . clearContentTypeSchema (
4545 fieldMetadata . content_type_uid
4646 ) ;
47-
48- // Fetch fresh field schema and data
49- const [ fieldSchema , fieldData ] = await Promise . all ( [
50- FieldSchemaMap . getFieldSchema (
51- fieldMetadata . content_type_uid ,
52- fieldMetadata . fieldPath
53- ) ,
54- getFieldData (
55- {
56- content_type_uid :
57- fieldMetadata . content_type_uid ,
58- entry_uid : fieldMetadata . entry_uid ,
59- locale : fieldMetadata . locale ,
60- } ,
61- fieldMetadata . fieldPathWithIndex
62- ) ,
63- ] ) ;
64-
65- if ( fieldSchema && fieldData ) {
66- return ;
67- }
6847 } catch ( fieldError ) {
6948 console . warn (
7049 "Failed to revalidate content type:" ,
Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ const DisableReason = {
1010 LocalizedEntry : "Editing this field is restricted in localized entries" ,
1111 UnlinkedVariant :
1212 "This field is not editable as it is not linked to the selected variant." ,
13- canLinkVaraint : "Click here to link a variant" ,
14- cannotLinkVariant : "Contact your stack admin or owner to link it." ,
13+ CanLinkVaraint : "Click here to link a variant" ,
14+ CannotLinkVariant : "Contact your stack admin or owner to link it." ,
1515 AudienceMode :
1616 "To edit an experience, open the Audience widget and click the Edit icon." ,
1717 DisabledVariant :
@@ -46,9 +46,9 @@ const getDisableReason = (
4646 if ( flags . updateRestrictDueToUnlinkVariant ) {
4747 let reason = DisableReason . UnlinkedVariant ;
4848 if ( flags . canLinkVariant ) {
49- reason += ` ${ DisableReason . canLinkVaraint } ` ;
49+ reason += ` ${ DisableReason . CanLinkVaraint } ` ;
5050 } else {
51- reason += ` ${ DisableReason . cannotLinkVariant } ` ;
51+ reason += ` ${ DisableReason . CannotLinkVariant } ` ;
5252 }
5353 return reason ;
5454 }
You can’t perform that action at this time.
0 commit comments