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) => {