Skip to content

Commit b65ca68

Browse files
fix(ui): thread id through instead of from routeParams (#13539)
Adjustment to #13526 Prefer to thread ID through arguments instead of relying on routeParams which would mean that ID is always a string - would not work for PG dbs or non-text based ID's.
1 parent 76741eb commit b65ca68

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

packages/next/src/views/Document/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ export const renderDocument = async ({
333333
}
334334

335335
const documentSlots = renderDocumentSlots({
336+
id,
336337
collectionConfig,
337338
globalConfig,
338339
hasSavePermission,

packages/next/src/views/Document/renderDocumentSlots.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ export const renderDocumentSlots: (args: {
2626
collectionConfig?: SanitizedCollectionConfig
2727
globalConfig?: SanitizedGlobalConfig
2828
hasSavePermission: boolean
29+
id?: number | string
2930
permissions: SanitizedDocumentPermissions
3031
req: PayloadRequest
3132
}) => DocumentSlots = (args) => {
32-
const { collectionConfig, globalConfig, hasSavePermission, req } = args
33+
const { id, collectionConfig, globalConfig, hasSavePermission, req } = args
3334

3435
const components: DocumentSlots = {} as DocumentSlots
3536

@@ -38,7 +39,7 @@ export const renderDocumentSlots: (args: {
3839
const isPreviewEnabled = collectionConfig?.admin?.preview || globalConfig?.admin?.preview
3940

4041
const serverProps: ServerProps = {
41-
id: req.routeParams.id as number | string,
42+
id,
4243
i18n: req.i18n,
4344
payload: req.payload,
4445
user: req.user,
@@ -169,10 +170,11 @@ export const renderDocumentSlots: (args: {
169170
return components
170171
}
171172

172-
export const renderDocumentSlotsHandler: ServerFunction<{ collectionSlug: string }> = async (
173-
args,
174-
) => {
175-
const { collectionSlug, req } = args
173+
export const renderDocumentSlotsHandler: ServerFunction<{
174+
collectionSlug: string
175+
id?: number | string
176+
}> = async (args) => {
177+
const { id, collectionSlug, req } = args
176178

177179
const collectionConfig = req.payload.collections[collectionSlug]?.config
178180

@@ -187,6 +189,7 @@ export const renderDocumentSlotsHandler: ServerFunction<{ collectionSlug: string
187189
})
188190

189191
return renderDocumentSlots({
192+
id,
190193
collectionConfig,
191194
hasSavePermission,
192195
permissions: docPermissions,

packages/translations/src/languages/is.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ export const isTranslations = {
286286
deletedAt: 'Eytt',
287287
deletedCountSuccessfully: 'Eyddi {{count}} {{label}}.',
288288
deletedSuccessfully: 'Eytt.',
289+
deleteLabel: 'Eyða {{label}}',
289290
deletePermanently: 'Sleppa rusli og eyða varanlega',
290291
deleting: 'Eyði...',
291292
depth: 'Dýpt',
@@ -345,6 +346,7 @@ export const isTranslations = {
345346
moveUp: 'Færa upp',
346347
moving: 'Færi',
347348
movingCount: 'Færi {{count}} {{label}}',
349+
newLabel: 'Nýtt {{label}}',
348350
newPassword: 'Nýtt lykilorð',
349351
next: 'Næsta',
350352
no: 'Nei',

packages/ui/src/providers/ServerFunctions/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ type CopyDataFromLocaleClient = (
9090

9191
type GetDocumentSlots = (args: {
9292
collectionSlug: string
93+
id?: number | string
9394
signal?: AbortSignal
9495
}) => Promise<DocumentSlots>
9596

0 commit comments

Comments
 (0)