perf: removes i18n.supportedLanguages from client config (#9209)

Similar to https://github.com/payloadcms/payload/pull/9195 but
specifically removing `i18n.supportedLanguages` from the client config.
This is a potentially large object that does not need to be sent through
the network when making RSC requests.
This commit is contained in:
Jacob Fletcher
2024-11-14 12:48:00 -05:00
committed by GitHub
parent 77c99c2f49
commit 5482e7ea15

View File

@@ -45,7 +45,8 @@ export type ClientConfig = {
collections: ClientCollectionConfig[]
custom?: Record<string, any>
globals: ClientGlobalConfig[]
} & Omit<SanitizedConfig, 'admin' | 'collections' | 'globals' | ServerOnlyRootProperties>
i18n?: Omit<SanitizedConfig['i18n'], 'supportedLanguages'>
} & Omit<SanitizedConfig, 'admin' | 'collections' | 'globals' | 'i18n' | ServerOnlyRootProperties>
export const serverOnlyAdminConfigProperties: readonly Partial<ServerOnlyRootAdminProperties>[] = []
@@ -92,6 +93,14 @@ export const createClientConfig = ({
}
}
if (
'i18n' in clientConfig &&
'supportedLanguages' in clientConfig.i18n &&
clientConfig.i18n.supportedLanguages
) {
delete clientConfig.i18n.supportedLanguages
}
if (!clientConfig.admin) {
clientConfig.admin = {} as ClientConfig['admin']
}