This repository was archived by the owner on Nov 22, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the goal of this cache was reusing the same prebootEl but I guess the biggest problem was probably not detaching it from the dom after destroying the app. If we move preboot to
createEngine()
which is the plan then this is fine since we're maintaining the same reference to the preboot config. During each req/res we're creating a new preboot config which was why I wanted to ensure if the configs are the same that we reuse the preboot elementThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I was curious if that was why this was being stringified! Makes sense, and I frankly would've left it but WeakMaps don't support non-object keys so to get the memory releasing map it has to be the original object
Until moving to
createEngine()
, could also consider using an LRU or LFU cache in that case if you want to have serialized keys in this cache without risks of memory leaks. happy to send a followup PR if there is any other way you want this implemented here 👍