Repository navigation
refactor(runtime): make WeakMap obsolete - #6156
Conversation
Could we put it behind a simple
Not sure about this. Again, if we put it behind a function it may just end up being a referenced stored in memory which I don't think has a big impact.
I can take a look at it 😉 @johnjenkins thoughts? |
Sounds workable to me? |
|
Use function call to resolve |
christian-bromann
left a comment
There was a problem hiding this comment.
Ok, I just double check the code, can we apply this as well in the following places?
- src/hydrate/platform/index.ts
- src/testing/platform/testing-constants.ts
- src/testing/platform/testing-host-ref.ts
- src/testing/platform/testing-platform.ts
Sure! Makes sense to remove the weakmaps there too. |
|
|
||
| lazyInstance.__stencil__getHostRef = () => hostRef; | ||
| hostRef.$lazyInstance$ = lazyInstance; | ||
| return hostRefs.set(lazyInstance, hostRef); |
There was a problem hiding this comment.
Not sure if the return value as weakmap is somewhere used, i tried to check the code but couldnt find any references which depends on the return value.
There was a problem hiding this comment.
Yeah, I think it doesn't have any impact.
christian-bromann
left a comment
There was a problem hiding this comment.
Thank you so much, this is awesome 👍
|
@danielleroux i think this was released in 4.27.0 - it’s a shame the release notes don’t mention refactors so your contribution didn’t get mentioned 😞 |
|
Oh I will make sure this PR is mentioned. |
What is the current behavior?
GitHub Issue Number: Fixes #6148
What is the new behavior?
Remove WeakMap and hold each
HostRefon the actual DOM Element. Which makes theWeakmapitself not necessary anymore.Issue to discuss:
Circular structure of HTMLElement (element ->$hostRef$ -> $hostElement$ -> $hostRef$ -> ...)Solved by usinggetHostRefAddSolved by usingHostRef(containing vdom structure) to regular DOM (Performance ?) => Checked the performance haven't found any issues yet.getHostRefWebDriver.IO cannot convert element to JSON (Circular structure of HTMLElement) which results in failing tests atm.Solved by usinggetHostRefDocumentation
Does this introduce a breaking change?
Testing
Use existing tests, not added new ones.