Fix: selector & rerender

This commit is contained in:
Dreamacro 2018-12-08 22:29:08 +08:00
parent ac6bac65aa
commit 3bf124dbb3
2 changed files with 11 additions and 16 deletions

View File

@ -40,10 +40,6 @@ export class Select extends React.Component<SelectProps, SelectState> {
hasCreateDropList: false
}
constructor (props) {
super(props)
}
componentDidMount () {
document.addEventListener('click', this.handleGlobalClick, true)
this.setState({ dropdownListStyles: this.calculateAttachmentPosition() })
@ -91,8 +87,7 @@ export class Select extends React.Component<SelectProps, SelectState> {
return {
top: Math.floor(targetRectInfo.top) - 10,
left: Math.floor(targetRectInfo.left) - 10,
width: Math.floor(targetRectInfo.width) + 10
left: Math.floor(targetRectInfo.left) - 10
}
}

View File

@ -47,10 +47,10 @@ class Proxies extends React.Component<ProxiesProps, ProxiesState> {
<Icon type="plus" size={20} style={{ fontWeight: 'bold' }} />
</Header>
{
config.state === 'ok' && <ul className="proxies-list">
config.config.proxy.length !== 0 && <ul className="proxies-list">
{
config.config.proxy.map((p, index) => (
<li key={index}>
<li key={p.name}>
<Proxy config={p} onEdit={() => this.setState({
showModifyProxyDialog: true,
activeConfig: p,
@ -65,6 +65,7 @@ class Proxies extends React.Component<ProxiesProps, ProxiesState> {
<div className="proxies-container">
<Header title={t('groupTitle')} />
</div>
</div>
{
showModifyProxyDialog && <ModifyProxyDialog
@ -73,7 +74,6 @@ class Proxies extends React.Component<ProxiesProps, ProxiesState> {
onCancel={() => this.setState({ showModifyProxyDialog: false, activeConfig: null, activeConfigIndex: -1 })}
/>
}
</div>
</>
)
}