Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ export function expandCustomTemplate(
): RuntimeBrickConf {
const tplContext = new CustomTemplateContext(proxyBrick);
const template = customTemplateRegistry.get(brickConf.brick);
if (template.contracts) {
collectWidgetContract(template.contracts);
}
if (Array.isArray(template.state)) {
tplContext.state.syncDefine(template.state, context, proxyBrick);
}
Expand All @@ -69,6 +72,9 @@ export async function asyncExpandCustomTemplate(
): Promise<RuntimeBrickConf> {
const tplContext = new CustomTemplateContext(proxyBrick);
const template = customTemplateRegistry.get(brickConf.brick);
if (template.contracts) {
collectWidgetContract(template.contracts);
}
if (Array.isArray(template.state)) {
await tplContext.state.define(template.state, context, proxyBrick);
}
Expand All @@ -88,7 +94,7 @@ function lowLevelExpandCustomTemplate(
context: PluginRuntimeContext,
tplContext: CustomTemplateContext
): RuntimeBrickConf {
const { bricks, proxy, state, contracts } = template;
const { bricks, proxy, state } = template;
const {
properties: templateProperties,
slots: externalSlots,
Expand All @@ -104,9 +110,6 @@ function lowLevelExpandCustomTemplate(
proxyBrick.proxyRefs = new Map();
proxyBrick.stateNames = state?.map((item) => item.name);

if (contracts) {
collectWidgetContract(contracts);
}
const refToBrickConf = collectRefsInTemplate(template);

// Reversed proxies are used for expand storyboard before rendering page.
Expand Down