From ed3814bff8cf42218fe5a9f068b0474cac73807d Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 27 Oct 2016 16:16:28 -0700 Subject: Fix identicon rendering --- ui/app/components/identicon.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'ui/app/components/identicon.js') diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js index 4b2bf899e..30ef6fbd3 100644 --- a/ui/app/components/identicon.js +++ b/ui/app/components/identicon.js @@ -16,8 +16,8 @@ function IdenticonComponent () { } IdenticonComponent.prototype.render = function () { - var state = this.props - var diameter = state.diameter || this.defaultDiameter + var props = this.props + var diameter = props.diameter || this.defaultDiameter return ( h('div', { key: 'identicon-' + this.props.address, @@ -33,15 +33,14 @@ IdenticonComponent.prototype.render = function () { } IdenticonComponent.prototype.componentDidMount = function () { - var state = this.props - var address = state.address + var props = this.props + var address = props.address if (!address) return var container = findDOMNode(this) - var diameter = state.diameter || this.defaultDiameter - var imageify = state.imageify === undefined ? true : state.imageify - var img = iconFactory.iconForAddress(address, diameter, imageify) + var diameter = props.diameter || this.defaultDiameter + var img = iconFactory.iconForAddress(address, diameter, false) container.appendChild(img) } -- cgit From f2bfdd7f8ca4d79b3143f39a7bec3b585d9c74b7 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Tue, 1 Nov 2016 17:04:36 -0700 Subject: Make identicon tolerant of changing state --- ui/app/components/identicon.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ui/app/components/identicon.js') diff --git a/ui/app/components/identicon.js b/ui/app/components/identicon.js index 30ef6fbd3..6d4871d02 100644 --- a/ui/app/components/identicon.js +++ b/ui/app/components/identicon.js @@ -44,3 +44,20 @@ IdenticonComponent.prototype.componentDidMount = function () { container.appendChild(img) } +IdenticonComponent.prototype.componentDidUpdate = function () { + var props = this.props + var address = props.address + + if (!address) return + + var container = findDOMNode(this) + + var children = container.children + for (var i = 0; i < children.length; i++) { + container.removeChild(children[i]) + } + + var diameter = props.diameter || this.defaultDiameter + var img = iconFactory.iconForAddress(address, diameter, false) + container.appendChild(img) +} -- cgit