fix(formula-field): remove afterSync hook
This commit is contained in:
parent
a214c7b2aa
commit
cd7338d1d8
@ -3,7 +3,7 @@ import { DataTypes } from 'sequelize';
|
|||||||
import { BaseFieldOptions, Field } from '@nocobase/database';
|
import { BaseFieldOptions, Field } from '@nocobase/database';
|
||||||
import evaluators from '@nocobase/evaluators';
|
import evaluators from '@nocobase/evaluators';
|
||||||
|
|
||||||
import { DataTypeTransformers, toDbType } from '../utils';
|
import { toDbType } from '../utils';
|
||||||
|
|
||||||
export interface FormulaFieldOptions extends BaseFieldOptions {
|
export interface FormulaFieldOptions extends BaseFieldOptions {
|
||||||
type: 'formula',
|
type: 'formula',
|
||||||
@ -102,7 +102,7 @@ export class FormulaField extends Field {
|
|||||||
|
|
||||||
bind() {
|
bind() {
|
||||||
super.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)
|
// TODO: should not depends on fields table (which is defined by other plugin)
|
||||||
this.database.on('fields.afterUpdate', this.updateFieldData);
|
this.database.on('fields.afterUpdate', this.updateFieldData);
|
||||||
this.on('beforeSave', this.calculateField);
|
this.on('beforeSave', this.calculateField);
|
||||||
@ -113,6 +113,6 @@ export class FormulaField extends Field {
|
|||||||
this.off('beforeSave', this.calculateField);
|
this.off('beforeSave', this.calculateField);
|
||||||
// TODO: should not depends on fields table
|
// TODO: should not depends on fields table
|
||||||
this.database.off('fields.afterUpdate', this.updateFieldData);
|
this.database.off('fields.afterUpdate', this.updateFieldData);
|
||||||
this.off('afterSync', this.initFieldData);
|
// this.off('afterSync', this.initFieldData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user