Skip to content

Commit

Permalink
fix(next): properly sets doc id types when using postgres (#9381)
Browse files Browse the repository at this point in the history
Fixes #9351. When using Postgres, doc ids were being treated as a string
as opposed to a number within the admin panel. This led to issues for
anything relying on the `docID` from context, such as the join field not
properly populating initial data when creating new documents, etc.
  • Loading branch information
jacobsfletch authored Nov 20, 2024
1 parent ef37483 commit 07a9125
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/next/src/utilities/initPage/handleAdminPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export function getRouteInfo({
globalConfig = config.globals.find((global) => global.slug === globalSlug)
}

// If the collection has an ID field, we need to determine the type of the ID field
// If the collection is using a custom ID, we need to determine it's type
if (collectionConfig && payload) {
if (payload.collections?.[collectionSlug]) {
if (payload.collections?.[collectionSlug]?.customIDType) {
idType = payload.collections?.[collectionSlug].customIDType
}
}
Expand Down
4 changes: 2 additions & 2 deletions test/joins/payload-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export interface Config {
user: User & {
collection: 'users';
};
jobs?: {
jobs: {
tasks: unknown;
workflows?: unknown;
workflows: unknown;
};
}
export interface UserAuthOperations {
Expand Down

0 comments on commit 07a9125

Please sign in to comment.