diff --git a/src/NotificationsHub.js b/src/NotificationsHub.js index 77135fef3..eafc75572 100644 --- a/src/NotificationsHub.js +++ b/src/NotificationsHub.js @@ -60,6 +60,8 @@ export default class Notifications extends FlipperDevicePlugin<{}> { return ( ({ @@ -90,6 +92,7 @@ type Props = {| selectedApp: ?string, deepLinkPayload?: ?string, }) => mixed, + selectedID: ?string, |}; type State = {| @@ -128,11 +131,16 @@ const NoContent = styled(FlexColumn)({ }); class NotificationsTable extends Component { - state = { - selectedNotification: null, - }; + static getDerivedStateFromProps(props: Props): State { + return { + selectedNotification: props.selectedID, + }; + } contextMenuItems = [{label: 'Clear all', click: this.props.onClear}]; + state: State = { + selectedNotification: this.props.selectedID, + }; componentDidUpdate(prevProps: Props) { if (this.props.filters.length !== prevProps.filters.length) { @@ -196,7 +204,8 @@ class NotificationsTable extends Component { onHide={() => this.onHide(n.pluginId)} selectPlugin={this.props.selectPlugin} /> - )); + )) + .reverse(); const invalidatedNotifications = this.props.invalidatedNotifications .filter(this.getFilter()) @@ -207,7 +216,8 @@ class NotificationsTable extends Component { onClear={this.props.onClear} inactive /> - )); + )) + .reverse(); return ( diff --git a/src/dispatcher/notifications.js b/src/dispatcher/notifications.js index c01d6ebf3..479f500ef 100644 --- a/src/dispatcher/notifications.js +++ b/src/dispatcher/notifications.js @@ -65,9 +65,9 @@ export default (store: Store, logger: Logger) => { notification.onclick = () => store.dispatch( selectPlugin({ - selectedPlugin: n.pluginId, - selectedApp: n.client, - deepLinkPayload: n.notification.action, + selectedPlugin: 'notifications', + selectedApp: null, + deepLinkPayload: n.notification.id, }), ); knownNotifications.add(n.notification.id);