Skip to content

Commit

Permalink
Mitigate memory increasing usage
Browse files Browse the repository at this point in the history
  • Loading branch information
cskrov committed Aug 30, 2024
1 parent 8a2db38 commit 7c27dab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions server/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"name": "Launch Program",
"skipFiles": ["<node_internals>/**"],
"program": "${workspaceFolder}/dist/server.js",
"args": ["--inspect-brk"],
"env": {
"NAIS_CLUSTER_NAME": "local"
},
"cwd": "${workspaceFolder}"
}
]
Expand Down
6 changes: 5 additions & 1 deletion server/src/nav-dekoratoren/nav-dekoratoren.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,10 @@ const fetchDecorator = async (url: string, props: DecoratorFetchProps, retries =
disableJavaScriptEvaluation: true,
},
});
window.document.write(html);
const { document } = window;

document.write(html);

const styles = document.getElementById('styles')?.innerHTML;
if (!styles) {
throw new Error('Decorator styles element not found!');
Expand Down Expand Up @@ -57,6 +58,9 @@ const fetchDecorator = async (url: string, props: DecoratorFetchProps, retries =
DECORATOR_FOOTER: footer.trim(),
};

document.close();
window.close();

return elements;
})
.catch((e) => {
Expand Down

0 comments on commit 7c27dab

Please sign in to comment.