Skip to content

Commit

Permalink
Update stringify options in codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinpalkovic committed Jan 11, 2024
1 parent 91f1bb8 commit 8193242
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export abstract class AbstractRenderer {

const currentStoryRender = {
storyFnAngular,
moduleMetadataSnapshot: stringify(moduleMetadata),
moduleMetadataSnapshot: stringify(moduleMetadata, { allowFunction: false }),
};

this.previousStoryRenderInfo.set(targetDOMNode, currentStoryRender);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ export class DiComponent {
}

elRefStr(): string {
return stringify(this.elRef, { maxDepth: 1 });
return stringify(this.elRef, { maxDepth: 1, allowFunction: false });
}
}
2 changes: 1 addition & 1 deletion code/lib/channels/src/postmessage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const { document, location } = global;

export const KEY = 'storybook-channel';

const defaultEventOptions = { allowFunction: true, maxDepth: 25 };
const defaultEventOptions = { allowFunction: false, maxDepth: 25 };

// TODO: we should export a method for opening child windows here and keep track of em.
// that way we can send postMessage to child windows as well, not just iframe
Expand Down
6 changes: 5 additions & 1 deletion code/lib/channels/src/websocket/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ export class WebsocketTransport implements ChannelTransport {
}

private sendNow(event: any) {
const data = stringify(event, { maxDepth: 15, allowFunction: true });
const data = stringify(event, {
maxDepth: 15,
allowFunction: false,
...global.CHANNEL_OPTIONS,
});
this.socket.send(data);
}

Expand Down
2 changes: 1 addition & 1 deletion code/ui/blocks/src/blocks/SourceContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { stringify } from 'telejson';

type ArgsHash = string;
export function argsHash(args: Args): ArgsHash {
return stringify(args);
return stringify(args, { allowFunction: false });
}

export interface SourceItem {
Expand Down

0 comments on commit 8193242

Please sign in to comment.