From 49e4d1abb22367ae7ed6d76615669301c1c66f00 Mon Sep 17 00:00:00 2001 From: Gajus Kuizinas Date: Wed, 15 Nov 2023 15:58:23 -0600 Subject: [PATCH] fix: use safe stringify --- src/browser.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/browser.ts b/src/browser.ts index fd9ccfb..43a0cc4 100644 --- a/src/browser.ts +++ b/src/browser.ts @@ -1,6 +1,7 @@ import { createLogger } from './factories/createLogger'; import { createRoarrInitialGlobalStateBrowser } from './factories/createRoarrInitialGlobalStateBrowser'; import { type MessageSerializer, type RoarrGlobalState } from './types'; +import safeStringify from 'safe-stable-stringify'; const ROARR = createRoarrInitialGlobalStateBrowser( (globalThis.ROARR as RoarrGlobalState) || {}, @@ -9,7 +10,7 @@ const ROARR = createRoarrInitialGlobalStateBrowser( globalThis.ROARR = ROARR; const serializeMessage: MessageSerializer = (message) => { - return JSON.stringify(message); + return safeStringify(message); }; const Roarr = createLogger((message) => {