From be3bb3e24e943c13f528e13ac96c349d633ba059 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 9 May 2026 14:35:09 +0200 Subject: [PATCH] Fix committing metadata value migrations In case the "oldValue" was a regex expression, the values never matched, which caused the value migration to never get committed. --- src/features/metadata/services/MetadataMigrations.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/features/metadata/services/MetadataMigrations.ts b/src/features/metadata/services/MetadataMigrations.ts index 033c8c30..56ec10a1 100644 --- a/src/features/metadata/services/MetadataMigrations.ts +++ b/src/features/metadata/services/MetadataMigrations.ts @@ -240,8 +240,11 @@ const getMetadataKeysWithUpdatedValues = ( const keysWithUpdatedValues = METADATA_MIGRATIONS.slice(migrationId).reduce((acc, migration) => { const keysWithUpdatedValuesOfMigration = Object.keys(metadata).filter((metadataKey) => migration.values?.some(({ key: migrationKey, oldValue }) => { + const currentValue = metadata[metadataKey]; + const isMigrationForAllKeys = !migrationKey; - const doesValueMatch = metadata[metadataKey] === oldValue; + const doesValueMatch = + oldValue instanceof RegExp ? currentValue.match(oldValue) : currentValue === oldValue; if (isMigrationForAllKeys) { return doesValueMatch;