mirror of
https://github.com/responsively-org/responsively-app
synced 2024-11-10 06:44:13 +00:00
fix: add migration to rename dpi to dpr in custom devices
This commit is contained in:
parent
a5bb9408d9
commit
1e41e38768
1 changed files with 23 additions and 0 deletions
|
@ -86,4 +86,27 @@ export const migrations = {
|
|||
},
|
||||
]);
|
||||
},
|
||||
'1.13.0': (store: Store) => {
|
||||
// Migrate dpi to dpr in custom devices
|
||||
try {
|
||||
const previousCustomDevices: any[] = store.get(
|
||||
'deviceManager.customDevices'
|
||||
) as any[];
|
||||
const newCustomDevices: Device[] = previousCustomDevices.map((device) => {
|
||||
const newDevice = {
|
||||
...device,
|
||||
dpr: device.dpi !== undefined ? device.dpi : device.dpr,
|
||||
};
|
||||
delete newDevice.dpi;
|
||||
return newDevice as Device;
|
||||
});
|
||||
store.set('deviceManager.customDevices', newCustomDevices);
|
||||
console.log(
|
||||
'Migration for 1.13.0 successful',
|
||||
store.get('deviceManager.customDevices')
|
||||
);
|
||||
} catch (e) {
|
||||
console.log('Migration for 1.13.0 failed', e);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue