-
Notifications
You must be signed in to change notification settings - Fork 51
Conversation
www/src/js/views/snap-details.js
Outdated
var Installer = require('../components/installer.js'); | ||
|
||
function SnapSize(props) { | ||
var model = props.model; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the functional components.. it's not necessary, but a bit more explicit/nicer to destructure the props into arguments you actually use. So SnapSize({model}). After a bit of reading; I think it's safe to do <SnapSize {...model.attributes} /> and SnapSize({size}). Then the first two lines disappear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes makes total sense, and keeps things tight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mostly stylistic nitpicking, otherwise nice implementation, with tests
www/src/js/views/snap-details.js
Outdated
|
||
module.exports = React.createBackboneClass({ | ||
componentWillMount: function() { | ||
var model = this.props.model; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const ?
www/src/js/views/snap-details.js
Outdated
module.exports = React.createBackboneClass({ | ||
componentWillMount: function() { | ||
var model = this.props.model; | ||
if (! model) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would feel better to trap this above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well ... even if trapped above, ... I tend to be very paranoid in js ... there are not real guarantees at the component level that we can put to force a non null model ... which makes me uneasy about removing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I simplified a bit the code for this
www/src/js/views/snap-details.js
Outdated
return; | ||
} | ||
|
||
var self = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leftover ?
www/src/js/views/snap-details.js
Outdated
}, | ||
|
||
onDownloadProgressChanged: function() { | ||
var model = this.props.model; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same pattern, I would simplify at least with something like :
if (this.props.model)
this.setState(...)
www/src/js/views/snap-details.js
Outdated
}, | ||
|
||
render: function() { | ||
var model = this.props.model; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
No description provided.