Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shy-wasps-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lit-labs/ssr': patch
---

Fix a memory leak when patching directive constructors for SSR.
4 changes: 4 additions & 0 deletions packages/labs/ssr/src/lib/render-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ const patchIfDirective = (value: unknown) => {
}
);
patchedDirectiveCache.set(directiveCtor, patchedCtor);
// If `patchIfDirective` is called with a previously patched directive,
// the patched directive will become patched again unless it's also a key
// in the WeakMap. This line prevents a memory leak.
patchedDirectiveCache.set(patchedCtor, patchedCtor);
}
// This property needs to remain unminified.
setDirectiveClass(value as DirectiveResult, patchedCtor);
Expand Down