From 0cb22186c9f34752ea0b48e17d50732c300b6c86 Mon Sep 17 00:00:00 2001 From: Odin Thomas Rochmann Date: Fri, 24 Jan 2025 10:38:18 +0100 Subject: [PATCH] fix(bookmark): improve handling of generator return values in BookmarkProvider --- packages/modules/bookmark/src/BookmarkProvider.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/modules/bookmark/src/BookmarkProvider.ts b/packages/modules/bookmark/src/BookmarkProvider.ts index 0d674fe11..4cc36c1d6 100644 --- a/packages/modules/bookmark/src/BookmarkProvider.ts +++ b/packages/modules/bookmark/src/BookmarkProvider.ts @@ -438,8 +438,7 @@ export class BookmarkProvider implements IBookmarkProvider { `bookmark data generator ${generator.name} returned a value, but it should not do this, since the data is an immer draft object`, ); // Dirty fix since some developers are returning the reference object, which will freeze the object - return JSON.parse(JSON.stringify(result)); - // return castDraft(result); + return castDraft(JSON.parse(JSON.stringify(result))); } // clear the bookmark data if the generator returns null