Skip to content

fix(ui): show dot menu when editMenuItems exist regardless of create/delete permission#16989

Merged
GermanJablo merged 2 commits into
payloadcms:mainfrom
jhjh1214:fix/edit-menu-items-visibility
Jun 18, 2026
Merged

fix(ui): show dot menu when editMenuItems exist regardless of create/delete permission#16989
GermanJablo merged 2 commits into
payloadcms:mainfrom
jhjh1214:fix/edit-menu-items-visibility

Conversation

@jhjh1214

Copy link
Copy Markdown
Contributor

Fixes #16975

What?

editMenuItems defined on a collection were silently hidden when both create and delete permissions were denied, because the three-dot menu's visibility (showDotMenu) was gated entirely on those permissions.

Why?

Custom editMenuItems represent arbitrary business logic unrelated to CRUD operations. A collection that blocks creation (e.g. webhook-only) and deletion (e.g. audit trail) should still expose custom actions like "Resend confirmation email".

How?

Added EditMenuItems as an additional condition in showDotMenu so the popup renders whenever custom items are present, regardless of create/delete access.

@GermanJablo GermanJablo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

auto-merge was automatically disabled June 17, 2026 16:42

Head branch was pushed to by a user without write access

@jhjh1214 jhjh1214 force-pushed the fix/edit-menu-items-visibility branch from 0232514 to 9412a83 Compare June 17, 2026 16:42
@jhjh1214 jhjh1214 requested a review from GermanJablo June 17, 2026 16:53
@jhjh1214

Copy link
Copy Markdown
Contributor Author

Hi @GermanJablo, thank you so much for approving this earlier and turning on auto-merge!

I just rebased the branch onto the latest main because the CI checks were failing with a "build cache not found" error across pretty much every test. I think it was because my branch was quite a few commits behind main, so the cache didn't match anymore. The actual code change is exactly the same as before, I only updated the base branch.

Since I don't have write access, the force push ended up turning off auto-merge automatically. Would you mind taking a quick look and turning it back on whenever you have time? Really appreciate your help and patience with this, still learning the ropes here!

Thanks again 🙏

@GermanJablo GermanJablo enabled auto-merge (squash) June 17, 2026 16:55
GermanJablo
GermanJablo previously approved these changes Jun 17, 2026
auto-merge was automatically disabled June 17, 2026 17:50

Head branch was pushed to by a user without write access

@jhjh1214

Copy link
Copy Markdown
Contributor Author

Hi @GermanJablo, quick update, and sorry in advance for the extra round trip.

Found and fixed a regression in this same diff. The EditMenuItems || change can make the dot menu render on the create view (no document id yet) for collections that have delete permission. That hits DeleteDocument's id={id.toString()} with id being undefined, which crashes the page. I added an id guard so DeleteDocument only renders once a document actually exists, and just pushed that fix.

This also explains the multi-tenant e2e failures from the earlier rerun, they're the same crash, not a separate issue. The logs show TypeError: Cannot read properties of undefined (reading 'toString') right before the .template-default--nav-hydrated timeout, the nav never finishes hydrating because the page crashed first. Should be resolved by the same fix.

Also heads up, this push dismissed your previous approval. Sorry about that, happy for you to take another look whenever you have time.

Thanks again for all the help with this one!

@GermanJablo GermanJablo enabled auto-merge (squash) June 17, 2026 18:42
@GermanJablo

Copy link
Copy Markdown
Contributor

No problem! Thanks for checking it out!

@jhjh1214

Copy link
Copy Markdown
Contributor Author

One more unrelated flake: live-preview failed with the same required-server-files.json ENOENT issue (looks like a timing race in the test harness's readiness check, possibly worse under shard parallelism, not connected to this diff). Would you mind giving it a rerun when you get a chance?

@GermanJablo GermanJablo merged commit 823bda2 into payloadcms:main Jun 18, 2026
335 of 339 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom editMenuItems are hidden when a collection denies both create and delete access

2 participants