Fix plugin to plugin deeplinking
Summary: Plugin to plugin deeplinking was broken because the state reducer was ignoring the parameter. This fixes it. Reviewed By: jonathoma Differential Revision: D19791230 fbshipit-source-id: 158b3a6278f5e634093c4284018458883e9aa5ca
This commit is contained in:
committed by
Facebook Github Bot
parent
c62127e56a
commit
652a95b664
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
import reducer from '../connections';
|
||||
import {State} from '../connections';
|
||||
import {State, selectPlugin} from '../connections';
|
||||
import BaseDevice from '../../devices/BaseDevice';
|
||||
import MacDevice from '../../devices/MacDevice';
|
||||
import {FlipperDevicePlugin} from '../../plugin';
|
||||
@@ -119,3 +119,11 @@ test('errors are collected on a by name basis', () => {
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
test('selectPlugin sets deepLinkPayload correctly', () => {
|
||||
const state = reducer(
|
||||
undefined,
|
||||
selectPlugin({selectedPlugin: 'myPlugin', deepLinkPayload: 'myPayload'}),
|
||||
);
|
||||
expect(state.deepLinkPayload).toBe('myPayload');
|
||||
});
|
||||
|
||||
@@ -223,7 +223,7 @@ const reducer = (state: State = INITAL_STATE, action: Actions): State => {
|
||||
}
|
||||
case 'SELECT_PLUGIN': {
|
||||
const {payload} = action;
|
||||
const {selectedPlugin, selectedApp} = payload;
|
||||
const {selectedPlugin, selectedApp, deepLinkPayload} = payload;
|
||||
const selectedDevice = payload.selectedDevice || state.selectedDevice;
|
||||
if (!selectDevice) {
|
||||
console.warn('Trying to select a plugin before a device was selected!');
|
||||
@@ -242,6 +242,7 @@ const reducer = (state: State = INITAL_STATE, action: Actions): State => {
|
||||
userPreferredDevice: selectedDevice
|
||||
? selectedDevice.title
|
||||
: state.userPreferredDevice,
|
||||
deepLinkPayload: deepLinkPayload,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user