diff --git a/desktop/app/src/dispatcher/__tests__/deeplinkURLParsing.node.js b/desktop/app/src/dispatcher/__tests__/deeplinkURLParsing.node.tsx similarity index 61% rename from desktop/app/src/dispatcher/__tests__/deeplinkURLParsing.node.js rename to desktop/app/src/dispatcher/__tests__/deeplinkURLParsing.node.tsx index cb35c72e6..a19150146 100644 --- a/desktop/app/src/dispatcher/__tests__/deeplinkURLParsing.node.js +++ b/desktop/app/src/dispatcher/__tests__/deeplinkURLParsing.node.tsx @@ -7,7 +7,7 @@ * @format */ -import {uriComponents} from '../application.tsx'; +import {uriComponents} from '../application'; test('test parsing of deeplink URL', () => { const url = 'flipper://app/plugin/meta/data'; @@ -22,6 +22,7 @@ test('test parsing of deeplink URL when arguments are less', () => { }); test('test parsing of deeplink URL when url is null', () => { + // @ts-ignore const components = uriComponents(null); expect(components).toEqual([]); }); @@ -31,3 +32,15 @@ test('test parsing of deeplink URL when pattern does not match', () => { const components = uriComponents(url); expect(components).toEqual([]); }); + +test('test parsing of deeplinkURL when there are query params', () => { + const url = 'flipper://null/React/?device=React%20Native'; + const components = uriComponents(url); + expect(components).toEqual(['null', 'React', '?device=React Native']); +}); + +test('test parsing of deeplinkURL when there are query params without slash', () => { + const url = 'flipper://null/React?device=React%20Native'; + const components = uriComponents(url); + expect(components).toEqual(['null', 'React', '?device=React Native']); +}); diff --git a/desktop/app/src/dispatcher/application.tsx b/desktop/app/src/dispatcher/application.tsx index 4f7a43e72..27bef94fc 100644 --- a/desktop/app/src/dispatcher/application.tsx +++ b/desktop/app/src/dispatcher/application.tsx @@ -32,7 +32,7 @@ export const uriComponents = (url: string): Array => { return []; } const match: Array | undefined | null = url.match( - /^flipper:\/\/([^\/]*)\/([^\/]*)\/?(.*)$/, + /^flipper:\/\/([^\/]*)\/([^\/\?]*)\/?(.*)$/, ); if (match) { return match.map(decodeURIComponent).slice(1).filter(Boolean); diff --git a/desktop/app/src/reducers/connections.tsx b/desktop/app/src/reducers/connections.tsx index 87defb798..1f10ca7ce 100644 --- a/desktop/app/src/reducers/connections.tsx +++ b/desktop/app/src/reducers/connections.tsx @@ -241,10 +241,7 @@ const reducer = (state: State = INITAL_STATE, action: Actions): State => { case 'SELECT_PLUGIN': { const {payload} = action; const {selectedPlugin, selectedApp, deepLinkPayload} = payload; - let selectedDevice = - selectedApp === null - ? null - : payload.selectedDevice || state.selectedDevice; + let selectedDevice = payload.selectedDevice; if (deepLinkPayload) { const deepLinkParams = new URLSearchParams(deepLinkPayload || ''); const deviceParam = deepLinkParams.get('device');