Skip to content

Commit

Permalink
query by blockType
Browse files Browse the repository at this point in the history
  • Loading branch information
r1tsuu committed Dec 26, 2024
1 parent a7fe234 commit 393db26
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/payload/src/database/getLocalizedPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@ export function getLocalizedPaths({
let matchedField: FlattenedField

if (lastIncompletePath?.field?.type === 'blocks') {
for (const block of lastIncompletePath.field.blocks) {
matchedField = block.flattenedFields.find((field) => field.name === segment)
if (matchedField) {
break
if (segment === 'blockType') {
matchedField = {
name: 'blockType',
type: 'text',
}
} else {
for (const block of lastIncompletePath.field.blocks) {
matchedField = block.flattenedFields.find((field) => field.name === segment)
if (matchedField) {
break
}
}
}
} else {
Expand Down

0 comments on commit 393db26

Please sign in to comment.