Support for implicit deferred triggers and better diagnostics for triggers#51922
Support for implicit deferred triggers and better diagnostics for triggers#51922crisbeto wants to merge 2 commits intoangular:mainfrom
Conversation
If a trigger element can't be accessed from the defer block, we don't generate any instructions for it. These changes add a diagnostic that will surface the error to users.
Adds support for defining `viewport`, `interaction` and `hover` triggers with no parameters. If the framework encounters such a case, it resolves the trigger to the root element of the `@placeholder` block. Triggers with no parameters have the following restrictions: 1. They have to be placed on an `@defer` block that has an `@placeholder`. 2. The `@placeholder` can only have one root node. 3. The root placeholder node has to be an element.
0f7d74f to
7378f3d
Compare
| // If the trigger doesn't have a reference, it is inferred as the root element node of the | ||
| // placeholder, if it only has one root node. Otherwise it's ambiguous so we don't | ||
| // attempt to resolve further. | ||
| return children !== null && children.length === 1 && children[0] instanceof Element ? |
There was a problem hiding this comment.
Why not just apply the trigger to every root node rather than require one?
There was a problem hiding this comment.
What we'd talked about was that if there are multiple root nodes, it could lead to some weird situations like a closing icon positioned at the top of the container causing the entire thing to load. Binding to each root node can also be a problem for the interaction and hover triggers, because there could be text nodes in-between that won't fire any events.
atscott
left a comment
There was a problem hiding this comment.
reviewed-for: public-api
|
This PR was merged into the repository by commit e2e3d69. |
Adds support for defining `viewport`, `interaction` and `hover` triggers with no parameters. If the framework encounters such a case, it resolves the trigger to the root element of the `@placeholder` block. Triggers with no parameters have the following restrictions: 1. They have to be placed on an `@defer` block that has an `@placeholder`. 2. The `@placeholder` can only have one root node. 3. The root placeholder node has to be an element. PR Close #51922
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…lar#51922) If a trigger element can't be accessed from the defer block, we don't generate any instructions for it. These changes add a diagnostic that will surface the error to users. PR Close angular#51922
…#51922) Adds support for defining `viewport`, `interaction` and `hover` triggers with no parameters. If the framework encounters such a case, it resolves the trigger to the root element of the `@placeholder` block. Triggers with no parameters have the following restrictions: 1. They have to be placed on an `@defer` block that has an `@placeholder`. 2. The `@placeholder` can only have one root node. 3. The root placeholder node has to be an element. PR Close angular#51922
Adds support for
viewport,hoverandinteractiondeferred triggers with an implicit element reference, as well as a diagnostic for the case where the deferred block can't resolve its trigger element. Split up into the following commits:fix(compiler): add diagnostic for inaccessible deferred trigger
If a trigger element can't be accessed from the defer block, we don't generate any instructions for it. These changes add a diagnostic that will surface the error to users.
feat(core): support deferred triggers with implicit triggers
Adds support for defining
viewport,interactionandhovertriggers with no parameters. If the framework encounters such a case, it resolves the trigger to the root element of the@placeholderblock. Triggers with no parameters have the following restrictions:@deferblock that has an@placeholder.@placeholdercan only have one root node.