From 509ee3a6e4fcf8eadcd265a0343773b2dd3c5908 Mon Sep 17 00:00:00 2001 From: David Sheldrick Date: Mon, 18 Dec 2023 15:45:52 +0000 Subject: [PATCH] Call devFreeze on initialData (#2332) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I noticed we weren't freezing the initialData passed into the store. ### Change Type - [x] `patch` — Bug fix --- packages/store/src/lib/Store.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/store/src/lib/Store.ts b/packages/store/src/lib/Store.ts index e715420f7..49492fe53 100644 --- a/packages/store/src/lib/Store.ts +++ b/packages/store/src/lib/Store.ts @@ -187,7 +187,10 @@ export class Store { objectMapFromEntries( objectMapEntries(initialData).map(([id, record]) => [ id, - atom('atom:' + id, this.schema.validateRecord(this, record, 'initialize', null)), + atom( + 'atom:' + id, + devFreeze(this.schema.validateRecord(this, record, 'initialize', null)) + ), ]) ) )