fix react embedly (#1089)

This commit is contained in:
Devin Howard 2017-03-09 11:23:24 -08:00 committed by Connor Turland
parent de4f51bb5c
commit 780e66632b
2 changed files with 8 additions and 3 deletions

View file

@ -9,7 +9,11 @@ class Attachments extends Component {
return ( return (
<div className="attachments"> <div className="attachments">
<EmbedlyLink link={link} authorizedToEdit={authorizedToEdit} updateTopic={updateTopic} /> <EmbedlyLink topicId={topic.id}
link={link}
authorizedToEdit={authorizedToEdit}
updateTopic={updateTopic}
/>
</div> </div>
) )
} }

View file

@ -34,7 +34,7 @@ class EmbedlyLink extends Component {
} }
render = () => { render = () => {
const { link, authorizedToEdit } = this.props const { link, authorizedToEdit, topicId } = this.props
const { linkEdit } = this.state const { linkEdit } = this.state
const hasAttachment = !!link const hasAttachment = !!link
@ -55,7 +55,7 @@ class EmbedlyLink extends Component {
{linkEdit && <div id="addLinkReset" onClick={this.resetLink}></div>} {linkEdit && <div id="addLinkReset" onClick={this.resetLink}></div>}
</div> </div>
</div> </div>
{link && <Card link={link} />} {link && <Card key={topicId} link={link} />}
{authorizedToEdit && ( {authorizedToEdit && (
<div id="linkremove" <div id="linkremove"
style={{ display: hasAttachment ? 'block' : 'none' }} style={{ display: hasAttachment ? 'block' : 'none' }}
@ -68,6 +68,7 @@ class EmbedlyLink extends Component {
} }
EmbedlyLink.propTypes = { EmbedlyLink.propTypes = {
topicId: PropTypes.number,
link: PropTypes.string, link: PropTypes.string,
authorizedToEdit: PropTypes.bool, authorizedToEdit: PropTypes.bool,
updateTopic: PropTypes.func updateTopic: PropTypes.func