File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -840,11 +840,16 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
840
840
} )
841
841
) ;
842
842
843
+ const pkField = resource . columns . find ( ( col ) => col . primaryKey ) ?. name ;
843
844
// remove all columns which are not defined in resources, or defined but backendOnly
844
845
data . data . forEach ( ( item ) => {
845
846
Object . keys ( item ) . forEach ( ( key ) => {
846
- console . log ( visibleColumns ?. [ key ] , key ) ;
847
- if ( ! resource . columns . find ( ( col ) => col . name === key ) || resource . columns . find ( ( col ) => col . name === key && col . backendOnly ) || visibleColumns ?. [ key ] === false ) {
847
+ const isPk = pkField && key === pkField ;
848
+ const isUnknown = ! resource . columns . find ( ( col ) => col . name === key ) ;
849
+ const isBackendOnly = resource . columns . find ( ( col ) => col . name === key && col . backendOnly ) ;
850
+ const isHiddenByACL = visibleColumns ?. [ key ] === false ;
851
+
852
+ if ( isUnknown || isBackendOnly || ( isHiddenByACL && ! isPk ) ) {
848
853
delete item [ key ] ;
849
854
}
850
855
} )
You can’t perform that action at this time.
0 commit comments