[Followup] Fix defaultValue with enum options update in migration v2 integration test + polish (#15300)
# Introduction Followup of https://github.com/twentyhq/twenty/pull/15286 - Polish replacing sorting by conditional filter and push - Integration test
This commit is contained in:
+6
-4
@@ -156,10 +156,12 @@ export class UpdateFieldActionHandlerService extends WorkspaceMigrationRunnerAct
|
||||
|
||||
let wasDefaultValueHandledByEnumUpdate = false;
|
||||
|
||||
const sortedUpdatesWithDefaultValuesUpdateLast = [...updates].sort(
|
||||
(a, b) =>
|
||||
+(a.property === 'defaultValue') - +(b.property === 'defaultValue'),
|
||||
);
|
||||
const sortedUpdatesWithDefaultValuesUpdateLast = hasDefaultValueUpdate
|
||||
? [
|
||||
...updates.filter((update) => update.property !== 'defaultValue'),
|
||||
defaultValueUpdate,
|
||||
]
|
||||
: updates;
|
||||
|
||||
for (const update of sortedUpdatesWithDefaultValuesUpdateLast) {
|
||||
if (isPropertyUpdate(update, 'name')) {
|
||||
|
||||
Reference in New Issue
Block a user