@payloadcms/next
Advanced tools
Comparing version 3.25.0-canary.d7d40bf to 3.25.0-canary.edf853a
@@ -1,6 +0,3 @@ | ||
import type { NavPreferences, Payload, User } from 'payload'; | ||
export declare const getNavPrefs: ({ payload, user }: { | ||
payload: Payload; | ||
user: User; | ||
}) => Promise<NavPreferences>; | ||
import type { DefaultDocumentIDType, NavPreferences, Payload } from 'payload'; | ||
export declare const getNavPrefs: (payload: Payload, userID: DefaultDocumentIDType, userSlug: string) => Promise<NavPreferences>; | ||
//# sourceMappingURL=getNavPrefs.d.ts.map |
import { cache } from 'react'; | ||
export const getNavPrefs = cache(async ({ | ||
payload, | ||
user | ||
}) => user ? await payload.find({ | ||
collection: 'payload-preferences', | ||
depth: 0, | ||
limit: 1, | ||
user, | ||
where: { | ||
and: [{ | ||
key: { | ||
equals: 'nav' | ||
} | ||
}, { | ||
'user.relationTo': { | ||
equals: user.collection | ||
} | ||
}, { | ||
'user.value': { | ||
equals: user.id | ||
} | ||
}] | ||
} | ||
})?.then(res => res?.docs?.[0]?.value) : null); | ||
export const getNavPrefs = cache(async (payload, userID, userSlug) => { | ||
return userSlug ? await payload.find({ | ||
collection: 'payload-preferences', | ||
depth: 0, | ||
limit: 1, | ||
pagination: false, | ||
where: { | ||
and: [{ | ||
key: { | ||
equals: 'nav' | ||
} | ||
}, { | ||
'user.relationTo': { | ||
equals: userSlug | ||
} | ||
}, { | ||
'user.value': { | ||
equals: userID | ||
} | ||
}] | ||
} | ||
})?.then(res => res?.docs?.[0]?.value) : null; | ||
}); | ||
//# sourceMappingURL=getNavPrefs.js.map |
@@ -49,6 +49,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
}))], permissions, i18n); | ||
const navPreferences = await getNavPrefs({ | ||
payload, | ||
user | ||
}); | ||
const navPreferences = await getNavPrefs(payload, user?.id, user?.collection); | ||
const LogoutComponent = RenderServerComponent({ | ||
@@ -55,0 +52,0 @@ clientProps: { |
@@ -65,6 +65,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
} | ||
const navPrefs = await getNavPrefs({ | ||
payload, | ||
user: req.user | ||
}); | ||
const navPrefs = await getNavPrefs(req.payload, req.user?.id, req.user?.collection); | ||
const clientConfig = getClientConfig({ | ||
@@ -71,0 +68,0 @@ config, |
@@ -121,3 +121,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
const resolvedFilterOptions = await resolveAllFilterOptions({ | ||
collectionConfig, | ||
fields: collectionConfig.fields, | ||
req | ||
@@ -124,0 +124,0 @@ }); |
@@ -1,6 +0,7 @@ | ||
import type { CollectionConfig, PayloadRequest, ResolvedFilterOptions } from 'payload'; | ||
export declare const resolveAllFilterOptions: ({ collectionConfig, req, }: { | ||
collectionConfig: CollectionConfig; | ||
import type { Field, PayloadRequest, ResolvedFilterOptions } from 'payload'; | ||
export declare const resolveAllFilterOptions: ({ fields, req, result, }: { | ||
fields: Field[]; | ||
req: PayloadRequest; | ||
result?: Map<string, ResolvedFilterOptions>; | ||
}) => Promise<Map<string, ResolvedFilterOptions>>; | ||
//# sourceMappingURL=resolveAllFilterOptions.d.ts.map |
import { resolveFilterOptions } from '@payloadcms/ui/rsc'; | ||
import { fieldIsHiddenOrDisabled } from 'payload/shared'; | ||
import { fieldHasSubFields, fieldIsHiddenOrDisabled } from 'payload/shared'; | ||
export const resolveAllFilterOptions = async ({ | ||
collectionConfig, | ||
req | ||
fields, | ||
req, | ||
result | ||
}) => { | ||
const resolvedFilterOptions = new Map(); | ||
await Promise.all(collectionConfig.fields.map(async field => { | ||
const resolvedFilterOptions = !result ? new Map() : result; | ||
await Promise.all(fields.map(async field => { | ||
if (fieldIsHiddenOrDisabled(field)) { | ||
@@ -24,2 +25,16 @@ return; | ||
} | ||
if (fieldHasSubFields(field)) { | ||
await resolveAllFilterOptions({ | ||
fields: field.fields, | ||
req, | ||
result: resolvedFilterOptions | ||
}); | ||
} | ||
if (field.type === 'tabs') { | ||
await Promise.all(field.tabs.map(tab => resolveAllFilterOptions({ | ||
fields: tab.fields, | ||
req, | ||
result: resolvedFilterOptions | ||
}))); | ||
} | ||
})); | ||
@@ -26,0 +41,0 @@ return resolvedFilterOptions; |
@@ -108,5 +108,2 @@ /** | ||
} | ||
if (nextConfig.assetPrefix) { | ||
toReturn.env.NEXT_ASSET_PREFIX = nextConfig.assetPrefix; | ||
} | ||
return toReturn; | ||
@@ -113,0 +110,0 @@ }; |
{ | ||
"name": "@payloadcms/next", | ||
"version": "3.25.0-canary.d7d40bf", | ||
"version": "3.25.0-canary.edf853a", | ||
"homepage": "https://payloadcms.com", | ||
@@ -82,5 +82,5 @@ "repository": { | ||
"uuid": "10.0.0", | ||
"@payloadcms/graphql": "3.25.0-canary.d7d40bf", | ||
"@payloadcms/translations": "3.25.0-canary.d7d40bf", | ||
"@payloadcms/ui": "3.25.0-canary.d7d40bf" | ||
"@payloadcms/graphql": "3.25.0-canary.edf853a", | ||
"@payloadcms/translations": "3.25.0-canary.edf853a", | ||
"@payloadcms/ui": "3.25.0-canary.edf853a" | ||
}, | ||
@@ -104,3 +104,3 @@ "devDependencies": { | ||
"@payloadcms/eslint-config": "3.9.0", | ||
"payload": "3.25.0-canary.d7d40bf" | ||
"payload": "3.25.0-canary.edf853a" | ||
}, | ||
@@ -110,3 +110,3 @@ "peerDependencies": { | ||
"next": "^15.0.0", | ||
"payload": "3.25.0-canary.d7d40bf" | ||
"payload": "3.25.0-canary.edf853a" | ||
}, | ||
@@ -113,0 +113,0 @@ "engines": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1779076
16494
+ Added@payloadcms/graphql@3.25.0-canary.edf853a(transitive)
+ Added@payloadcms/translations@3.25.0-canary.edf853a(transitive)
+ Added@payloadcms/ui@3.25.0-canary.edf853a(transitive)
+ Addedpayload@3.25.0-canary.edf853a(transitive)
- Removed@payloadcms/graphql@3.25.0-canary.d7d40bf(transitive)
- Removed@payloadcms/translations@3.25.0-canary.d7d40bf(transitive)
- Removed@payloadcms/ui@3.25.0-canary.d7d40bf(transitive)
- Removedpayload@3.25.0-canary.d7d40bf(transitive)