File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -522,6 +522,8 @@ class AdminForth implements IAdminForth {
522522 return { error : err } ;
523523 }
524524
525+ const recordWithVirtualColumns = record ;
526+
525527 // execute hook if needed
526528 for ( const hook of listify ( resource . hooks ?. create ?. beforeSave ) ) {
527529 console . log ( '🪲 Hook beforeSave' , hook ) ;
@@ -563,7 +565,7 @@ class AdminForth implements IAdminForth {
563565 return { error } ;
564566 }
565567
566- const primaryKey = record [ resource . columns . find ( ( col ) => col . primaryKey ) . name ] ;
568+ const primaryKey = createdRecord [ resource . columns . find ( ( col ) => col . primaryKey ) . name ] ;
567569
568570 // execute hook if needed
569571 for ( const hook of listify ( resource . hooks ?. create ?. afterSave ) ) {
@@ -574,6 +576,7 @@ class AdminForth implements IAdminForth {
574576 record : createdRecord ,
575577 adminUser,
576578 adminforth : this ,
579+ recordWithVirtualColumns,
577580 extra,
578581 } ) ;
579582
Original file line number Diff line number Diff line change @@ -568,6 +568,7 @@ export type AfterCreateSaveFunction = (params: {
568568 adminUser : AdminUser ,
569569 record : any ,
570570 adminforth : IAdminForth ,
571+ recordWithVirtualColumns ?: any ,
571572 extra ?: HttpExtra ,
572573} ) => Promise < { ok : boolean , error ?: string } > ;
573574
You can’t perform that action at this time.
0 commit comments