@@ -523,25 +523,26 @@ export const getRawEntityRecord = createSelector(
523523 name ,
524524 key
525525 ) ;
526- return (
527- record &&
528- Object . keys ( record ) . reduce ( ( accumulator , _key ) => {
529- if (
530- isRawAttribute ( getEntityConfig ( state , kind , name ) , _key )
531- ) {
532- // Because edits are the "raw" attribute values,
533- // we return those from record selectors to make rendering,
534- // comparisons, and joins with edits easier.
535- accumulator [ _key ] =
536- record [ _key ] ?. raw !== undefined
537- ? record [ _key ] ?. raw
538- : record [ _key ] ;
539- } else {
540- accumulator [ _key ] = record [ _key ] ;
526+ const config = getEntityConfig ( state , kind , name ) ;
527+ if ( ! record || ! config ?. rawAttributes ?. length ) {
528+ return record ;
529+ }
530+
531+ // Because edits are the "raw" attribute values,
532+ // we return those from record selectors to make rendering,
533+ // comparisons, and joins with edits easier.
534+ return Object . fromEntries (
535+ Object . keys ( record ) . map ( ( _key ) => {
536+ if ( isRawAttribute ( config , _key ) ) {
537+ const rawValue = record [ _key ] ?. raw ;
538+ return [
539+ _key ,
540+ rawValue !== undefined ? rawValue : record [ _key ] ,
541+ ] ;
541542 }
542- return accumulator ;
543- } , { } as any )
544- ) ;
543+ return [ _key , record [ _key ] ] ;
544+ } )
545+ ) as EntityRecord ;
545546 } ,
546547 (
547548 state : State ,
0 commit comments