Skip to content

Commit d31a41b

Browse files
committed
fix(vscode-theming): refactor sendFileToApp to use parsed data directly
1 parent 73b29c9 commit d31a41b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/mcp/src/renderer/page.session.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,17 @@ export async function sendFileToApp(
7676
content: string,
7777
fileName: string
7878
): Promise<void> {
79+
const data = JSON.parse(content);
80+
7981
await page.evaluate(
80-
({ content, fileName, origin }) => {
82+
({ data, fileName, origin }) => {
8183
const iframe = document.querySelector('iframe') as HTMLIFrameElement;
8284
iframe.contentWindow?.postMessage(
83-
{ type: 'LOAD_FILE', payload: { data: JSON.parse(content), fileName } },
85+
{ type: 'LOAD_FILE', payload: { data, fileName } },
8486
origin
8587
);
8688
},
87-
{ content, fileName, origin: QM_APP_ORIGIN }
89+
{ data, fileName, origin: QM_APP_ORIGIN }
8890
);
8991
}
9092

0 commit comments

Comments
 (0)