From cd7338d1d8d41a73998f47e4eb2b9833b59d16cb Mon Sep 17 00:00:00 2001 From: chenos Date: Mon, 6 Mar 2023 11:58:21 +0800 Subject: [PATCH] fix(formula-field): remove afterSync hook --- packages/plugins/formula-field/src/server/formula-field.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/plugins/formula-field/src/server/formula-field.ts b/packages/plugins/formula-field/src/server/formula-field.ts index 519ccc6189..eaa67832b3 100644 --- a/packages/plugins/formula-field/src/server/formula-field.ts +++ b/packages/plugins/formula-field/src/server/formula-field.ts @@ -3,7 +3,7 @@ import { DataTypes } from 'sequelize'; import { BaseFieldOptions, Field } from '@nocobase/database'; import evaluators from '@nocobase/evaluators'; -import { DataTypeTransformers, toDbType } from '../utils'; +import { toDbType } from '../utils'; export interface FormulaFieldOptions extends BaseFieldOptions { type: 'formula', @@ -102,7 +102,7 @@ export class FormulaField extends Field { bind() { super.bind(); - this.on('afterSync', this.initFieldData); + // this.on('afterSync', this.initFieldData); // TODO: should not depends on fields table (which is defined by other plugin) this.database.on('fields.afterUpdate', this.updateFieldData); this.on('beforeSave', this.calculateField); @@ -113,6 +113,6 @@ export class FormulaField extends Field { this.off('beforeSave', this.calculateField); // TODO: should not depends on fields table this.database.off('fields.afterUpdate', this.updateFieldData); - this.off('afterSync', this.initFieldData); + // this.off('afterSync', this.initFieldData); } }