From 1bb446b14c70de9024c8bb48e743780cf9358ffc Mon Sep 17 00:00:00 2001 From: "Xc@centOs" Date: Wed, 8 Feb 2023 22:20:18 +0800 Subject: [PATCH] =?UTF-8?q?selection=E4=B8=AD=E4=B8=80=E4=B8=AA=E5=A4=84?= =?UTF-8?q?=E7=90=86=E4=B8=8D=E5=AE=8C=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/store/selection.js | 5 +---- src/store/selection.ts | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/store/selection.js b/lib/store/selection.js index c58d32f..f4588d6 100644 --- a/lib/store/selection.js +++ b/lib/store/selection.js @@ -29,9 +29,6 @@ function getOperationRewriters() { */ function reinforceSelection(schema, entity, selection) { var filter = selection.filter, data = selection.data, sorter = selection.sorter; - Object.assign(data, { - '$$createAt$$': 1, - }); // 有的页面依赖于其它页面取数据,有时两个页面的filter的差异会导致有一个加createAt,有一个不加,此时可能产生前台取数据不完整的异常。先统一加上 var checkNode = function (projectionNode, attrs) { attrs.forEach(function (attr) { var _a; @@ -153,7 +150,7 @@ function reinforceSelection(schema, entity, selection) { var projectionNodeDict = {}; var checkProjectionNode = function (entity2, projectionNode) { var _a, _b, _c; - var necessaryAttrs = ['id']; + var necessaryAttrs = ['id', '$$createAt$$']; // 因有的页面依赖于其他页面的数据,因此默认的createAt的filter不一定会加上,为了保险起见在这里统一加上 for (var attr in projectionNode) { if (attr === '#id') { (0, assert_1.default)(!projectionNodeDict[projectionNode[attr]], "projection\u4E2D\u7ED3\u70B9\u7684id\u6709\u91CD\u590D, ".concat(projectionNode[attr])); diff --git a/src/store/selection.ts b/src/store/selection.ts index 41f9e21..e0b403d 100644 --- a/src/store/selection.ts +++ b/src/store/selection.ts @@ -35,9 +35,6 @@ function getOperationRewriters() { */ export function reinforceSelection(schema: StorageSchema, entity: keyof ED, selection: ED[keyof ED]['Selection']) { const { filter, data, sorter } = selection; - Object.assign(data, { - '$$createAt$$': 1, - }); // 有的页面依赖于其它页面取数据,有时两个页面的filter的差异会导致有一个加createAt,有一个不加,此时可能产生前台取数据不完整的异常。先统一加上 const checkNode = (projectionNode: ED[keyof ED]['Selection']['data'], attrs: string[]) => { attrs.forEach( @@ -157,7 +154,7 @@ export function reinforceSelection(schema: StorageSchema< const toBeAssignNode2: Record = {}; // 用来记录在表达式中涉及到的结点 const projectionNodeDict: Record = {}; const checkProjectionNode = (entity2: keyof ED, projectionNode: ED[keyof ED]['Selection']['data']) => { - const necessaryAttrs: string[] = ['id']; + const necessaryAttrs: string[] = ['id', '$$createAt$$']; // 因有的页面依赖于其他页面的数据,因此默认的createAt的filter不一定会加上,为了保险起见在这里统一加上 for (const attr in projectionNode) { if (attr === '#id') { assert(!projectionNodeDict[projectionNode[attr]!], `projection中结点的id有重复, ${projectionNode[attr]}`);