Skip to content

Fix Admin UI remaining editable when graphql.omit.update is set - #10007

Open
FirmaSpring wants to merge 2 commits into
keystonejs:mainfrom
FirmaSpring:fix/omit-update-itemview
Open

Fix Admin UI remaining editable when graphql.omit.update is set#10007
FirmaSpring wants to merge 2 commits into
keystonejs:mainfrom
FirmaSpring:fix/omit-update-itemview

Conversation

@FirmaSpring

Copy link
Copy Markdown
Contributor

Problem

When graphql.omit.update is set on a field, the Admin UI item view can still be editable.

packages/core/src/lib/core/initialise-lists.ts currently prefers the configured ui.itemView.fieldMode even after update is omitted. If a developer (or a leftover default) sets fieldMode: 'edit', the field is shown as editable even though GraphQL has no update input for it. This is the remaining case of #9665 after #9663/#9664.

Solution

If graphql.omit.update is true and the field is still readable, force itemView.fieldMode to 'read'. An explicit edit configuration cannot override the omitted update operation.

Verification

Added graphql.omit.update forces itemView.fieldMode to read even if edit is configured in tests/api-tests/admin-meta.test.ts.

Fixes #9665

Force itemView.fieldMode to read when update is omitted from GraphQL, even if ui.itemView.fieldMode is configured as edit.

Co-authored-by: FirmamentalSpring <287222957+FirmaSpring@users.noreply.github.com>
@FirmaSpring
FirmaSpring force-pushed the fix/omit-update-itemview branch from 17dd953 to 955916a Compare August 17, 2026 07:50

@emmatown emmatown left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This would break a dynamic fieldMode changing between read and hidden

Only coerce a static edit mode to read. Functions and filter objects
that switch between read and hidden stay intact.

Co-authored-by: FirmamentalSpring <287222957+FirmaSpring@users.noreply.github.com>
@FirmaSpring

Copy link
Copy Markdown
Contributor Author

Thanks @emmatown. The previous change collapsed any non-hidden fieldMode to a static read, which would break a dynamic fieldMode that switches between read and hidden.

I updated this so graphql.omit.update only coerces a static edit to read. Functions and filter objects are left intact, and a function that resolves to edit is still demoted to read. Added coverage for both a function and a { hidden } filter.

tests/api-tests/admin-meta.test.ts is green locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants