mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-19 03:55:50 +08:00
fix(editor): 初始化收集依赖后编译数据源不能使用源数据
This commit is contained in:
parent
c87e539dd3
commit
84bf9ba2f9
@ -369,15 +369,13 @@ export const initServiceEvents = (
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateStageDsl = async (value: MApp | null) => {
|
const updateStageDsl = async (value: MApp | null) => {
|
||||||
const dsl = cloneDeep(toRaw(value));
|
|
||||||
|
|
||||||
const stage = await getStage();
|
const stage = await getStage();
|
||||||
|
|
||||||
const runtime = await stage.renderer?.getRuntime();
|
const runtime = await stage.renderer?.getRuntime();
|
||||||
const app = await getTMagicApp();
|
const app = await getTMagicApp();
|
||||||
|
|
||||||
if (!app?.dataSourceManager) {
|
if (!app?.dataSourceManager) {
|
||||||
runtime?.updateRootConfig?.(dsl!);
|
runtime?.updateRootConfig?.(cloneDeep(toRaw(value))!);
|
||||||
}
|
}
|
||||||
|
|
||||||
const page = editorService.get('page');
|
const page = editorService.get('page');
|
||||||
@ -389,15 +387,18 @@ export const initServiceEvents = (
|
|||||||
|
|
||||||
if (value) {
|
if (value) {
|
||||||
depService.clearIdleTasks();
|
depService.clearIdleTasks();
|
||||||
await (typeof Worker === 'undefined' ? collectIdle(value.items, true) : depService.collectByWorker(value));
|
|
||||||
|
|
||||||
if (value.dataSources && value.dataSourceDeps && app?.dataSourceManager) {
|
const dsl = cloneDeep(toRaw(value));
|
||||||
for (const node of getNodes(getDepNodeIds(value.dataSourceDeps), value.items)) {
|
|
||||||
updateNode(app.dataSourceManager.compiledNode(node), value);
|
await (typeof Worker === 'undefined' ? collectIdle(dsl.items, true) : depService.collectByWorker(dsl));
|
||||||
|
|
||||||
|
if (dsl.dataSources && dsl.dataSourceDeps && app?.dataSourceManager) {
|
||||||
|
for (const node of getNodes(getDepNodeIds(dsl.dataSourceDeps), dsl.items)) {
|
||||||
|
updateNode(app.dataSourceManager.compiledNode(node), dsl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
runtime?.updateRootConfig?.(cloneDeep(value));
|
runtime?.updateRootConfig?.(dsl);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user