Skip to content

Commit

Permalink
Fix initialData passing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
antonkov committed Jul 22, 2023
1 parent 352338b commit ff95640
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 3 additions & 5 deletions app/src/indexBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ import { useInterval } from "usehooks-ts";

interface PaperProofWindow extends Window {
sessionId: string | null;
initialInfo: string | null;
initialInfo: any | null;
}

declare const window: PaperProofWindow;

const BASE_URL = "https://paperproof.xyz";

// TODO: We should use the vscode font for consistency with Lean probably
// const fontFamily = 'Menlo, Monaco, "Courier New", monospace;'

Expand Down Expand Up @@ -122,7 +120,7 @@ function Main() {
// It runs as an extension
return;
}
fetch(`${BASE_URL}/getTypes?sessionId=${sessionId}`)
fetch(`/getTypes?sessionId=${sessionId}`)
.then((response) => response.json())
.then((newResponse) => {
if (apiResponse && newResponse.id === apiResponse.id) return;
Expand Down Expand Up @@ -158,7 +156,7 @@ function Main() {
}
if (window.initialInfo) {
const newResponse: ApiResponse = {
...JSON.parse(window.initialInfo),
...window.initialInfo,
id: BY_POST_MESSAGE,
};
updateUi(app, newResponse, apiResponse);
Expand Down
Binary file modified extension/paperproof-0.0.5.vsix
Binary file not shown.
4 changes: 1 addition & 3 deletions extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ function getWebviewContent(initialInfo: object | null) {
<title>Paperproof</title>
</head>
<body>
<script>initialInfo = ${
initialInfo ? JSON.stringify(initialInfo) : null
}</script>
<script>initialInfo = ${initialInfo}</script>
<div id="root"></div>
<script src="${SERVER_URL}/indexBrowser.js"></script>
</body>
Expand Down

0 comments on commit ff95640

Please sign in to comment.