From c290af3aaadd88da369fc2be4565c61e32840ecd Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Wed, 15 Nov 2023 11:56:43 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Options=20are=20immutable,=20clo?= =?UTF-8?q?ne=20options=20object?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/four-tips-peel.md | 5 +++++ packages/myst-config/src/site/validators.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/four-tips-peel.md diff --git a/.changeset/four-tips-peel.md b/.changeset/four-tips-peel.md new file mode 100644 index 000000000..f56d5208a --- /dev/null +++ b/.changeset/four-tips-peel.md @@ -0,0 +1,5 @@ +--- +'myst-config': patch +--- + +The options are immutable and we must clone the object. diff --git a/packages/myst-config/src/site/validators.ts b/packages/myst-config/src/site/validators.ts index 33018e0e5..3c188efb1 100644 --- a/packages/myst-config/src/site/validators.ts +++ b/packages/myst-config/src/site/validators.ts @@ -179,7 +179,7 @@ export function validateSiteConfig(input: any, opts: ValidationOptions) { opts.errorLogFn?.(`duplicate value for site option ${key}`); } else { opts.warningLogFn?.(`extra site options should be nested under "options" key: ${key}`); - (value.options ??= {})[key] = valueAsObject[key]; + value.options = { ...value.options, [key]: valueAsObject[key] }; } }); return validateSiteConfigKeys(value, opts);