mirror of
https://github.com/responsively-org/responsively-app
synced 2024-11-10 14:54:12 +00:00
Fixed the crash when a custom device is added to the preview for the first time
This commit is contained in:
parent
ea0fb9a0b5
commit
c5a52abc79
1 changed files with 5 additions and 3 deletions
|
@ -872,14 +872,16 @@ export const defaultDevices: Device[] = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const customDevices: Device[] =
|
const customDevices: () => Device[] = () => {
|
||||||
typeof window !== 'undefined'
|
return typeof window !== 'undefined'
|
||||||
? window.electron.store.get('deviceManager.customDevices')
|
? window.electron.store.get('deviceManager.customDevices')
|
||||||
: [];
|
: [];
|
||||||
|
};
|
||||||
|
|
||||||
type DeviceMap = { [key: string]: Device };
|
type DeviceMap = { [key: string]: Device };
|
||||||
|
|
||||||
export const getDevicesMap = (): DeviceMap => {
|
export const getDevicesMap = (): DeviceMap => {
|
||||||
return [...defaultDevices, ...customDevices].reduce(
|
return [...defaultDevices, ...customDevices()].reduce(
|
||||||
(map: DeviceMap, device) => {
|
(map: DeviceMap, device) => {
|
||||||
map[device.id] = device;
|
map[device.id] = device;
|
||||||
return map;
|
return map;
|
||||||
|
|
Loading…
Reference in a new issue