@@ -610,13 +610,13 @@ function renderTemplate(value: any, template: string): string {
610610}
611611
612612function handleUpdate(value : any ) {
613- const primaryKey = Object . keys ( props .item ). find (( key ) => key === ' id ' || key . endsWith ( ' _id ' )) ;
613+ const itemId = props .item ?.[ primaryKeyField . value ] ;
614614
615- if (primaryKey ) {
615+ if (itemId !== undefined && itemId !== null ) {
616616 // Check if this is a full translations update
617617 if (typeof value === ' object' && value ?.isFullTranslations ) {
618618 // Handle full translations update from interface-translations
619- emit (' update' , props . item [ primaryKey ] , ' translations' , {
619+ emit (' update' , itemId , ' translations' , {
620620 isFullTranslations: true ,
621621 translations: value .translations ,
622622 });
@@ -631,17 +631,17 @@ function handleUpdate(value: any) {
631631 language: fieldLanguage .value , // Use language from field key or selected
632632 isTranslation: true ,
633633 };
634- emit (' update' , props . item [ primaryKey ] , props .fieldKey , translationUpdate );
634+ emit (' update' , itemId , props .fieldKey , translationUpdate );
635635 } else {
636- emit (' update' , props . item [ primaryKey ] , props .fieldKey , value );
636+ emit (' update' , itemId , props .fieldKey , value );
637637 }
638638 }
639639}
640640
641641function handleBooleanToggle(value : boolean ) {
642- const primaryKey = Object . keys ( props .item ). find (( key ) => key === ' id ' || key . endsWith ( ' _id ' )) ;
643- if (primaryKey ) {
644- emit (' update' , props . item [ primaryKey ] , props .fieldKey , value );
642+ const itemId = props .item ?.[ primaryKeyField . value ] ;
643+ if (itemId !== undefined && itemId !== null ) {
644+ emit (' update' , itemId , props .fieldKey , value );
645645 }
646646}
647647
0 commit comments