Do not import already imported data
Summary: Before this diff, if one imported same file twice, it duplicated app data.This diff fixes that. When one tries to import the already imported file then this diff will select that flipper files device in the UI. Reviewed By: jknoxville Differential Revision: D14045145 fbshipit-source-id: f17c83486ffcdb0e2a57c70b1589e34567811d01
This commit is contained in:
committed by
Facebook Github Bot
parent
c912dcaf48
commit
059ac83fcf
@@ -220,13 +220,25 @@ export const importFileToStore = (file: string, store: Store) => {
|
||||
// During the export, Date is exported as string
|
||||
return {...log, date: new Date(log.date)};
|
||||
});
|
||||
const {serial, deviceType, title, os} = device;
|
||||
const archivedDevice = new ArchivedDevice(
|
||||
device.serial,
|
||||
device.deviceType,
|
||||
device.title,
|
||||
device.os,
|
||||
serial,
|
||||
deviceType,
|
||||
title,
|
||||
os,
|
||||
updatedLogs,
|
||||
);
|
||||
const devices = store.getState().connections.devices;
|
||||
const matchedDevices = devices.filter(
|
||||
availableDevice => availableDevice.serial === serial,
|
||||
);
|
||||
if (matchedDevices.length > 0) {
|
||||
store.dispatch({
|
||||
type: 'SELECT_DEVICE',
|
||||
payload: matchedDevices[0],
|
||||
});
|
||||
return;
|
||||
}
|
||||
store.dispatch({
|
||||
type: 'REGISTER_DEVICE',
|
||||
payload: archivedDevice,
|
||||
|
||||
Reference in New Issue
Block a user