Skip to content

Commit

Permalink
Ignore defaultValue property in workspace:sync-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ad-elias committed Nov 22, 2024
1 parent 74ba5e3 commit 028628c
Showing 1 changed file with 4 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import {
} from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/comparator.interface';
import { ComputedPartialFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-field-metadata.interface';

import {
FieldMetadataEntity,
FieldMetadataType,
} from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
import { transformMetadataForComparison } from 'src/engine/workspace-manager/workspace-sync-metadata/comparators/utils/transform-metadata-for-comparison.util';

const commonFieldPropertiesToIgnore = [
Expand All @@ -26,6 +23,7 @@ const commonFieldPropertiesToIgnore = [
'gate',
'asExpression',
'generatedType',
'defaultValue',
];

const fieldPropertiesToStringify = ['defaultValue'] as const;
Expand Down Expand Up @@ -57,19 +55,11 @@ export class WorkspaceFieldComparator {
const originalFieldMetadataMap = transformMetadataForComparison(
filteredOriginalFieldCollection,
{
shouldIgnoreProperty: (property, originalMetadata) => {
shouldIgnoreProperty: (property) => {
if (commonFieldPropertiesToIgnore.includes(property)) {
return true;
}

if (
originalMetadata &&
property === 'defaultValue' &&
originalMetadata.type === FieldMetadataType.SELECT
) {
return true;
}

return false;
},
propertiesToStringify: fieldPropertiesToStringify,
Expand All @@ -82,19 +72,11 @@ export class WorkspaceFieldComparator {
const standardFieldMetadataMap = transformMetadataForComparison(
standardFieldMetadataCollection,
{
shouldIgnoreProperty: (property, originalMetadata) => {
shouldIgnoreProperty: (property) => {
if (commonFieldPropertiesToIgnore.includes(property)) {
return true;
}

if (
originalMetadata &&
property === 'defaultValue' &&
originalMetadata.type === FieldMetadataType.SELECT
) {
return true;
}

return false;
},
propertiesToStringify: fieldPropertiesToStringify,
Expand Down

0 comments on commit 028628c

Please sign in to comment.