fix: defaultPopulate and populate with nested to arrays/blocks properties (#9751)
Fixes https://github.com/payloadcms/payload/issues/9718
### What?
`defaultPopulate` and `populate` didn't work properly when defining
nested to arrays and blocks properties:
```ts
import type { CollectionConfig } from 'payload'
export const Pages: CollectionConfig<'pages'> = {
slug: 'pages',
defaultPopulate: {
slug: true,
array: {
title: true,
},
blocks: {
some: {
title: true,
},
},
},
access: { read: () => true },
fields: [
{
name: 'slug',
type: 'text',
required: true,
},
{
name: 'additional',
type: 'text',
},
{
name: 'array',
type: 'array',
fields: [
{
name: 'title',
type: 'text',
},
{
name: 'other',
type: 'text',
},
],
},
{
name: 'blocks',
type: 'blocks',
blocks: [
{
slug: 'some',
fields: [
{
name: 'title',
type: 'text',
},
{
name: 'other',
type: 'text',
},
],
},
],
},
],
}
```
### Why?
This should work
### How?
Turns out, it wasn't a great idea to mutate passed `select` directly in
`afterRead/promise.ts` to force select some properties `id` ,
`blockType`. Now we do shallow copies when needed.