diff --git a/src/plugins/network/index.tsx b/src/plugins/network/index.tsx index f8e84349a..8d6b8046c 100644 --- a/src/plugins/network/index.tsx +++ b/src/plugins/network/index.tsx @@ -39,6 +39,7 @@ type PersistedState = { type State = { selectedIds: Array; + searchTerm: string; }; const COLUMN_SIZE = { @@ -166,10 +167,27 @@ export default class extends FlipperPlugin { } }; - state = { - selectedIds: this.props.deepLinkPayload ? [this.props.deepLinkPayload] : [], + parseDeepLinkPayload = (deepLinkPayload: string | null) => { + const searchTermDelim = 'searchTerm='; + if (deepLinkPayload === null) { + return { + selectedIds: [], + searchTerm: '', + }; + } else if (deepLinkPayload.startsWith(searchTermDelim)) { + return { + selectedIds: [], + searchTerm: deepLinkPayload.slice(searchTermDelim.length), + }; + } + return { + selectedIds: [deepLinkPayload], + searchTerm: '', + }; }; + state = this.parseDeepLinkPayload(this.props.deepLinkPayload); + onRowHighlighted = (selectedIds: Array) => this.setState({selectedIds}); @@ -229,6 +247,7 @@ export default class extends FlipperPlugin { highlightedRows={ this.state.selectedIds ? new Set(this.state.selectedIds) : null } + searchTerm={this.state.searchTerm} /> {this.renderSidebar()} @@ -243,6 +262,7 @@ type NetworkTableProps = { copyRequestCurlCommand: () => void; onRowHighlighted: (keys: TableHighlightedRows) => void; highlightedRows: Set | null | undefined; + searchTerm: string; }; type NetworkTableState = { @@ -481,6 +501,7 @@ class NetworkTable extends PureComponent { allowBodySearch={true} zebra={false} actions={} + defaultSearchTerm={this.props.searchTerm} /> );