Skip to content

Commit

Permalink
Merge pull request #918 from responsively-org/preview-suite-migration…
Browse files Browse the repository at this point in the history
…-hotfix

Preview suites migration hotfix
  • Loading branch information
manojVivek authored May 7, 2023
2 parents a806348 + a4b2620 commit bf7a252
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion desktop-app/release/app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ResponsivelyApp",
"version": "1.2.0",
"version": "1.2.1",
"description": "A developer-friendly browser for developing responsive web apps",
"license": "MIT",
"author": {
Expand Down
29 changes: 28 additions & 1 deletion desktop-app/src/store/migrations.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import Store from 'electron-store';
import { randomUUID } from 'crypto';

import { PreviewSuites } from '../renderer/store/features/device-manager';

import { defaultDevices, Device } from '../common/deviceList';

const defaultActiveDevices = ['10008', '10013', '10015'];
Expand Down Expand Up @@ -50,15 +52,40 @@ export const migrations = {
{
id: 'default',
name: 'Default',
devices: newActiveDevices,
devices:
newActiveDevices.length > 0
? newActiveDevices
: defaultActiveDevices,
},
]);
} catch (e) {
// eslint-disable-next-line no-console
console.log('Migration failed', e);
store.set('deviceManager.previewSuites', [
{
id: 'default',
name: 'Default',
devices: defaultActiveDevices,
},
]);
return;
}
// eslint-disable-next-line no-console
console.log('Migration successful', store.get('deviceManager'));
},
'1.2.1': (store: Store) => {
const suites = store.get('deviceManager.previewSuites') as
| PreviewSuites
| undefined;
if (suites == null || suites.length > 0) {
return;
}
store.set('deviceManager.previewSuites', [
{
id: 'default',
name: 'Default',
devices: defaultActiveDevices,
},
]);
},
};

0 comments on commit bf7a252

Please sign in to comment.