-
Notifications
You must be signed in to change notification settings - Fork 794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(runtime): make WeakMap obsolete #6156
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 |
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.
Two minor nits
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.
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. |
hostRef.$lazyInstance$ = lazyInstance; | ||
return hostRefs.set(lazyInstance, hostRef); |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it doesn't have any impact.
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.
Thank you so much, this is awesome 👍
What is the current behavior?
GitHub Issue Number: Fixes #6148
What is the new behavior?
Remove WeakMap and hold each
HostRef
on the actual DOM Element. Which makes theWeakmap
itself not necessary anymore.Issue to discuss:
Circular structure of HTMLElement (element ->$hostRef$ -> $hostElement$ -> $hostRef$ -> ...)Solved by usinggetHostRef
AddSolved by usingHostRef
(containing vdom structure) to regular DOM (Performance ?) => Checked the performance haven't found any issues yet.getHostRef
WebDriver.IO cannot convert element to JSON (Circular structure of HTMLElement) which results in failing tests atm.Solved by usinggetHostRef
Documentation
Does this introduce a breaking change?
Testing
Use existing tests, not added new ones.