diff --git a/src/dispatcher/notifications.tsx b/src/dispatcher/notifications.tsx index e6b0fa8b6..796602198 100644 --- a/src/dispatcher/notifications.tsx +++ b/src/dispatcher/notifications.tsx @@ -12,7 +12,7 @@ import {Logger} from '../fb-interfaces/Logger'; import {PluginNotification} from '../reducers/notifications'; import {FlipperPlugin, FlipperDevicePlugin} from '../plugin'; import isHeadless from '../utils/isHeadless'; -import {setStaticView} from '../reducers/connections'; +import {setStaticView, setDeeplinkPayload} from '../reducers/connections'; import {ipcRenderer, IpcRendererEvent} from 'electron'; import { setActiveNotifications, @@ -41,12 +41,14 @@ export default (store: Store, logger: Logger) => { 'notificationEvent', ( _event: IpcRendererEvent, - _e: Error, eventName: NotificationEvents, pluginNotification: PluginNotification, arg: null | string | number, ) => { if (eventName === 'click' || (eventName === 'action' && arg === 0)) { + store.dispatch( + setDeeplinkPayload(pluginNotification.notification.action ?? null), + ); store.dispatch(setStaticView(NotificationScreen)); } else if (eventName === 'action') { if (arg === 1 && pluginNotification.notification.category) { diff --git a/src/reducers/connections.tsx b/src/reducers/connections.tsx index 6aed84e9f..7a5a2fb29 100644 --- a/src/reducers/connections.tsx +++ b/src/reducers/connections.tsx @@ -61,7 +61,7 @@ export type State = { deviceId?: string; errorMessage?: string; }>; - deepLinkPayload: null | string; + deepLinkPayload: string | null; staticView: StaticView; }; @@ -143,6 +143,10 @@ export type Action = type: 'SELECT_CLIENT'; payload: string; } + | { + type: 'SET_DEEPLINK_PAYLOAD'; + payload: null | string; + } | RegisterPluginAction; const DEFAULT_PLUGIN = 'DeviceLogs'; @@ -382,7 +386,9 @@ const reducer = (state: State = INITAL_STATE, action: Actions): State => { errors, }; } - + case 'SET_DEEPLINK_PAYLOAD': { + return {...state, deepLinkPayload: action.payload}; + } case 'REGISTER_PLUGINS': { // plugins are registered after creating the base devices, so update them const plugins = action.payload; @@ -499,6 +505,11 @@ export const selectClient = (clientId: string): Action => ({ payload: clientId, }); +export const setDeeplinkPayload = (payload: string | null): Action => ({ + type: 'SET_DEEPLINK_PAYLOAD', + payload, +}); + export function getAvailableClients( device: null | undefined | BaseDevice, clients: Client[], diff --git a/src/ui/components/searchable/Searchable.tsx b/src/ui/components/searchable/Searchable.tsx index aca3cb9da..f86dbaa69 100644 --- a/src/ui/components/searchable/Searchable.tsx +++ b/src/ui/components/searchable/Searchable.tsx @@ -260,7 +260,7 @@ const Searchable = ( prevProps.defaultSearchTerm !== this.props.defaultSearchTerm || prevProps.defaultFilters !== this.props.defaultFilters ) { - newSearchTerm = this.props.defaultSearchTerm; + newSearchTerm = this.props.defaultSearchTerm ?? ''; } this.setState({ filters: mergedFilters,