Skip to content

Commit

Permalink
fix: use safe stringify
Browse files Browse the repository at this point in the history
  • Loading branch information
gajus committed Nov 15, 2023
1 parent 83b46f9 commit 49e4d1a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/browser.ts
Original file line number Diff line number Diff line change
@@ -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) || {},
Expand All @@ -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) => {
Expand Down

0 comments on commit 49e4d1a

Please sign in to comment.