-
Notifications
You must be signed in to change notification settings - Fork 190
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
add modifiers to debug render tree #1559
add modifiers to debug render tree #1559
Conversation
8769217
to
a9d1be4
Compare
QUnit.on('testEnd', (testEnd) => { | ||
if (testEnd.status === 'failed') { | ||
testEnd.errors.forEach((assertion) => { | ||
console.error(assertion.stack); |
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.
prints error stack traces from tests to console, useful for debugging, like clicking on error location to jump to the code
d9cf236
to
d8abb13
Compare
I am not sure that it is a good idea to add more work here, especially to the close element operation which affects every single element we render which can add up. I don’t love the architecture of the inspector integration today, the code is not strippable, has some non-zero impact even when it’s not enabled, and IIRC it’s enabled pretty much any time that the inspector is installed, not just when the inspector is visible or the rendering tab is selected. We probably need to think harder about whether that is ok before adding even more work there, especially something as impactful as this. Doing it for modifiers itself is probably not an issue, it’s the fact that you need some way to tie it to the element and that led you to add HTML nodes to the tree that is the problem. Beyond what I said above it will also make the tree vastly bigger and you may run into slowness in serializing the tree and sending it over to the inspector. That happens every time something changes and causes a re-render (even for no-op re-render). If you just want to add modifier node without introducing html element parents here I think that would be fine. We still give you a reference to the element anyway and you can probably still group them in the inspector’s processing code if you want. |
@chancancode i tried to improve the performance by checking with a |
@@ -84,7 +84,7 @@ export class NewElementBuilder implements ElementBuilder { | |||
[CURSOR_STACK] = new Stack<Cursor>(); | |||
private modifierStack = new Stack<Nullable<ModifierInstance[]>>(); | |||
private blockStack = new Stack<LiveBlock>(); | |||
private htmlElementsState: { shouldAddHtmlElement?: boolean }[]; | |||
private htmlElementsState = new Set(); |
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.
Maybe you are not fully done, but to be clear about what I meant in the comment – in the final state of the PR (w.r.t. "I think it would be fine if we just want to add modifiers to the tree without adding elements"), this should not even be needed, and that we wouldn't have added the new "html-element" type to the tree at all. When I say you can infer and group them in the inspector if you want to, I mean you can do that using the bounds, which would presumably reference the element they are attached to, and then you can recreate the grouping with a weak map or something on the inspector side.
And, yes, if it's feasible and about the same amount of code, it would probably be a good idea to do the work in pushModifier
rather than in closeElement
, all else being equal.
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, now there is a html element which wraps only the modifiers. the rest can be done in inspector
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.
As I was saying above, let’s not even add that
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.
updated
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.
see above
ce6ec47
to
8b98f28
Compare
@chancancode i update the PR. |
Gonna circle back to the inspector stuff after finishing #1568 (which could use a review from you) |
I found that in-element needed to add a destructor to release it in the debug render tree. Does this also need something similar? |
I think i move everything to
|
446661a
to
d066dba
Compare
d066dba
to
9150788
Compare
registerDestructor(state, () => { | ||
vm.env.debugRenderTree?.willDestroy(state); | ||
}); | ||
} |
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.
Most of these are analogous to the component equivalent in the same file
8b2c275
to
facb979
Compare
facb979
to
bfeebae
Compare
bfeebae
to
1b47565
Compare
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.
Thanks for doing putting this together! and the test was most helpful in helping understand what's expected of the debug render tree for modifiers <3
No description provided.