From 3ff6969a83a0e77e1ad60fbab4bbb71b5d3b47e9 Mon Sep 17 00:00:00 2001 From: Satya Sivunigunta Date: Sat, 18 Jul 2026 16:31:30 -0700 Subject: [PATCH] fix: don't crash the code field editor when a field has no options A user-configured code field with no options block (e.g. a collection body field declared as 'type: code' in .pages.yml) crashes the entry editor with "Cannot read properties of undefined (reading 'lintFn')": the extensions memo reads field.options.lintFn without optional chaining. The memo's own dependency array already uses field.options?.format and field.options?.lintFn, so this aligns the guard with the surrounding code. --- fields/core/code/edit-component.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fields/core/code/edit-component.tsx b/fields/core/code/edit-component.tsx index 980b90ac8..81a742fd9 100644 --- a/fields/core/code/edit-component.tsx +++ b/fields/core/code/edit-component.tsx @@ -55,7 +55,7 @@ const EditComponent = forwardRef((props: any, ref: any) => { break; } - if (field.options.lintFn) { + if (field.options?.lintFn) { exts.push(linter(field.options.lintFn)); }