From 640c1744ecd7ddb8999551579a46b016216a4134 Mon Sep 17 00:00:00 2001 From: Ben Woosley Date: Tue, 12 Dec 2017 00:32:30 -0800 Subject: [PATCH] fix(prop-types): Improve propTypes for Peer and Peers through use of shape --- app/components/Peers/Peer.js | 5 ++++- app/routes/peers/components/Peers.js | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/components/Peers/Peer.js b/app/components/Peers/Peer.js index 0dee5302..5d9684a2 100644 --- a/app/components/Peers/Peer.js +++ b/app/components/Peers/Peer.js @@ -10,7 +10,10 @@ const Peer = ({ peer, setPeer }) => ( ) Peer.propTypes = { - peer: PropTypes.object.isRequired, + peer: PropTypes.shape({ + address: PropTypes.string.isRequired, + pub_key: PropTypes.string.isRequired + }).isRequired, setPeer: PropTypes.func.isRequired } diff --git a/app/routes/peers/components/Peers.js b/app/routes/peers/components/Peers.js index e7d10d66..2b1b4e9e 100644 --- a/app/routes/peers/components/Peers.js +++ b/app/routes/peers/components/Peers.js @@ -128,9 +128,10 @@ Peers.propTypes = { peerModalOpen: PropTypes.bool.isRequired, filteredPeers: PropTypes.array.isRequired, - peers: PropTypes.object.isRequired, - peer: PropTypes.object, - searchQuery: PropTypes.string + peers: PropTypes.shape({ + peer: PropTypes.object, + searchQuery: PropTypes.string + }).isRequired } export default Peers