fix(ui): add Below action respects filterOptions in blocks field#15918
fix(ui): add Below action respects filterOptions in blocks field#15918ossaidqadri wants to merge 2 commits intopayloadcms:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a Payload Admin UI bug where the Blocks field “Add Below” row action did not respect filterOptions, causing the drawer to show unfiltered blocks.
Changes:
- Pass filtered block options down to row-level actions so “Add Below” uses the same filtered list as the main “Add content” button.
- Update
RowActionsto preferfilteredBlockswhen rendering theBlocksDrawer. - Adjust root
package.jsonworkspace/overrides configuration (not directly related to the UI fix).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/ui/src/fields/Blocks/index.tsx | Passes filtered blocks to each row so row actions can respect filterOptions. |
| packages/ui/src/fields/Blocks/BlockRow.tsx | Threads filteredBlocks through to RowActions. |
| packages/ui/src/fields/Blocks/RowActions.tsx | Uses filteredBlocks for the row-level drawer to fix “Add Below” filtering. |
| package.json | Updates workspace paths and moves dependency overrides configuration. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
package.json
Outdated
| "overrides": { | ||
| "copyfiles": "$copyfiles", | ||
| "cross-env": "$cross-env", | ||
| "dotenv": "$dotenv", | ||
| "graphql": "16.8.1", | ||
| "react": "$react", | ||
| "react-dom": "$react-dom", | ||
| "typescript": "$typescript" | ||
| } |
There was a problem hiding this comment.
The repo appears to use pnpm-specific configuration for dependency overrides (e.g. test/package.json uses pnpm.overrides). Moving overrides to the root-level overrides key may not be consistently applied by pnpm tooling and diverges from the existing pattern—consider keeping these under pnpm.overrides for consistency and to avoid installs behaving differently across workspaces.
| }} | ||
| addRowIndex={rowIndex} | ||
| blocks={blocks} | ||
| blocks={filteredBlocks || blocks} |
There was a problem hiding this comment.
This change fixes the UI behavior, but there doesn’t appear to be an e2e regression test covering the "Add Below" row action respecting filterOptions (current conditional blocks tests only cover the bottom "Add content" drawer). Adding a Playwright assertion in test/fields/collections/Blocks/e2e.spec.ts would prevent this from regressing again.
| blocks={filteredBlocks || blocks} | |
| blocks={filteredBlocks ?? blocks} |
| "workspaces": [ | ||
| "packages/*", | ||
| "test/*" | ||
| "tools/*", | ||
| "test", | ||
| "templates/blank", | ||
| "templates/website", | ||
| "templates/ecommerce" | ||
| ], |
There was a problem hiding this comment.
The PR is scoped to a UI bugfix (Blocks "Add Below" respecting filterOptions), but this change also rewrites the root workspaces list. If this is intentional housekeeping, it would be better split into a separate PR (or called out explicitly in the PR description) to keep the fix focused and reduce release risk.
- Move overrides to pnpm.overrides for pnpm consistency - Use nullish coalescing (??) instead of OR (||) in RowActions - Add e2e test verifying Add Below respects filterOptions - Revert unrelated workspaces changes to keep PR focused
Fixes #15829