fix(ivy): do not throw if host style is on a template node (#30498)
In View Engine, we would simply ignore host style bindings on template nodes. In Ivy, we are throwing a "Cannot read length of undefined" error instead. For backwards compatibility, we should also ignore these bindings rather than blowing up. PR Close #30498
This commit is contained in:

committed by
Jason Aden

parent
f2ae452f01
commit
c62c5e2999
@ -35,9 +35,12 @@ export function registerHostDirective(context: StylingContext, directiveIndex: n
|
||||
*/
|
||||
export function enqueueHostInstruction<T extends Function>(
|
||||
context: StylingContext, priority: number, instructionFn: T, instructionFnArgs: ParamsOf<T>) {
|
||||
const buffer: HostInstructionsQueue = context[StylingIndex.HostInstructionsQueue] !;
|
||||
const index = findNextInsertionIndex(buffer, priority);
|
||||
buffer.splice(index, 0, priority, instructionFn, instructionFnArgs);
|
||||
const buffer: HostInstructionsQueue|null = context[StylingIndex.HostInstructionsQueue];
|
||||
// Buffer may be null if host element is a template node. In this case, just ignore the style.
|
||||
if (buffer != null) {
|
||||
const index = findNextInsertionIndex(buffer, priority);
|
||||
buffer.splice(index, 0, priority, instructionFn, instructionFnArgs);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user