1
0
mirror of synced 2026-04-04 07:08:34 +08:00

fix(core,data-source): 多个页面片容器引用同一个页面片时,其他有未渲染的页面片容器时会导致数据源编译后数据无法更新

This commit is contained in:
roymondchen
2026-03-19 11:34:51 +08:00
parent f6bd647958
commit 0bbafa153d
2 changed files with 7 additions and 5 deletions

View File

@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { union } from 'lodash-es';
import { cloneDeep, union } from 'lodash-es';
import type { default as TMagicApp } from '@tmagic/core';
import { getDepNodeIds, getNodes, isPage, isPageFragment, replaceChildNode } from '@tmagic/core';
@@ -82,11 +82,11 @@ export const createDataSourceManager = (app: TMagicApp, useMock?: boolean, initi
for (const [, pageFragment] of app.pageFragments) {
if (pageFragment.data.id === newNode.id) {
pageFragment.setData(newNode);
pageFragment.setData(cloneDeep(newNode));
} else if (pageFragment.data.id === page.id) {
pageFragment.getNode(newNode.id, { strict: true })?.setData(newNode);
pageFragment.getNode(newNode.id, { strict: true })?.setData(cloneDeep(newNode));
if (!pageFragment.instance) {
replaceChildNode(newNode, [pageFragment.data]);
replaceChildNode(cloneDeep(newNode), [pageFragment.data]);
}
}
}