-
Notifications
You must be signed in to change notification settings - Fork 611
feat: enable stringification of DOM nodes controlled by FAST's renderer #6485
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
feat: enable stringification of DOM nodes controlled by FAST's renderer #6485
Conversation
📊 Tachometer Benchmark ResultsSummaryclickTrigger10x
create10k
createDelete5x
runFile1k
update10th
usedJSHeapSize
Resultsobservable-runFile1k
runFile1k
usedJSHeapSize
render-create10k
create10k
usedJSHeapSize
render-createDelete5x
createDelete5x
usedJSHeapSize
render-update10th
update10th
usedJSHeapSize
repeat-basic-splice-itemCount=1000&deleteCount=20&addCount=20
clickTrigger10x
usedJSHeapSize
repeat-nested-push-itemCount=100&addCount=20
clickTrigger10x
usedJSHeapSize
repeat-nested-reverse-itemCount=100
clickTrigger10x
usedJSHeapSize
repeat-nested-shift-itemCount=100
clickTrigger10x
usedJSHeapSize
repeat-nested-unshift-itemCount=100&addCount=20
clickTrigger10x
usedJSHeapSize
|
nicholasrice
left a comment
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.
Looks good, thanks Rob! Did you determine that $fastController wouldn't be an issue?
Oops. Forgot to check that one. That's likely an issue. I'm off for the weekend. I'll add some code for that on Monday. |
Ok, I've added that scenario. Should be good to go now. |
…er (#6485) * test: add basic ref tests * fix: prevent children behavior from causing errors if dom stringified * test: add slot stringify guard * fix: prevent all binding types from causing errors if dom stringified * doc: mark toJSON methods as internal so they don't clutter the APIs * Change files * chore: fix change file * fix: prevent serialized web components from throwing Co-authored-by: EisenbergEffect <roeisenb@microsoft.com>
Pull Request
📖 Description
Some 3rd party script have odd behaviors where they attempt to
JSON.stringifyDOM node instances. This can result in errors in some cases where FAST is storing controllers/state on the node for quick access. This PR prevents errors that could occur during stringification.🎫 Issues
👩💻 Reviewer Notes
The main fix was to provide explicit
toJSONimplementations on core FAST types. These implementations are no ops so that FAST types aren't serialized at all. The problem caused by this situation was a bit more complex than this and so also required a few other internal changes to core types to ensure that we could no op the quick access properties to begin with.📑 Test Plan
Tests were added for:
refslottedchildrenonChangebindingsoneTimebindingstwoWaybindingssignalbindingseventbindingsAdditionally, some basic tests were added for
refwhich were previously missing.✅ Checklist
General
$ yarn change⏭ Next Steps
This will create some merge conflicts with the security work branch. So, next steps will be to fix all of that up.
After the security work is merged we'll also need to do a general cleanup pass on
fast-element. While working on the last couple of PRs I've noticed some negative effects of all the recent code churn and they need to be addressed before this library is ready to be used in production.