Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (!args.view || !args.view.__GlimmerComponent__) {
let template;
if (args.view && args.view.__GlimmerComponentBuilder__) {
console.info(`instantiating component in keyed view item ${args.view.__GlimmerNativeElement__.id} for item index ${args.index}`);
args.view.__GlimmerComponentBuilder__(item);
args.view.__GlimmerComponentBuilder__ = null; // free the memory
return;
}
template = listView.itemTemplates.filter((x) => x.key == 'default')[0];
if (!template) {
console.info(`Counldn't determine component to use for item at ${args.index}`);
return;
}
let wrapper = createElement('StackLayout');
wrapper.setAttribute('id', `default-${this.numberViewsCreated}`);
inTransaction(Application.aotRuntime.env, () => {
renderItem(wrapper, { compiled: template.component, args: template.args }, item);
});
args.view = wrapper.nativeView;
}
else {
inTransaction(Application.aotRuntime.env, () => {
let componentInstance = args.view.__GlimmerComponent__;
const oldState = componentInstance.state.value();
// Update the state with the new item
componentInstance.update(Object.assign(Object.assign({}, oldState), { item }));
});
}
});
}
);
(args.view as any).__GlimmerComponentBuilder__(item);
(args.view as any).__GlimmerComponentBuilder__ = null; // free the memory
return;
}
template = (listView as any).itemTemplates.filter((x) => x.key == 'default')[0];
if (!template) {
console.info(`Counldn't determine component to use for item at ${args.index}`);
return;
}
let wrapper = createElement('StackLayout') as NativeViewElementNode
template = (listView as any).itemTemplates.filter((x) => x.key == 'default')[0];
if (!template) {
console.info(`Counldn't determine component to use for item at ${args.index}`);
return;
}
let wrapper = createElement('StackLayout') as NativeViewElementNode
return __awaiter(this, void 0, void 0, function* () {
try {
inTransaction(Application.aotRuntime.env, () => {
Application.result.rerender();
Application._rendered = true;
});
console.log('Result Re-rendered');
}
catch (error) {
console.log(`Error in re-render: ${error}`);
}
});
}