Skip to content

Commit

Permalink
perf: use PureComponent instead of Component
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed May 14, 2017
1 parent d5b7528 commit 7191ffd
Show file tree
Hide file tree
Showing 16 changed files with 17 additions and 21 deletions.
2 changes: 1 addition & 1 deletion client/redux/actions/sizes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import {createAction} from 'Utils';

export const setSize = createAction('SET_SIZE', (type, value) => ({type, value}))
export const setSize = createAction('SET_SIZE', (type, value) => ({type, value: Number(value)}))
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import fs from 'fs'

require('./index.scss')

class Config extends React.Component {
class Config extends React.PureComponent {
constructor() {
super()
this.state = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react'
import Sortable from 'sortablejs'

class Favorite extends React.Component {
class Favorite extends React.PureComponent {
constructor() {
super()
this.state = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'

require('./index.scss')

export default class AddButton extends React.Component {
export default class AddButton extends React.PureComponent {
render() {
return (<div className="AddButton">
{this.props.title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const timeScale = new humanFormat.Scale({
d: 86400000
})

class Footer extends React.Component {
class Footer extends React.PureComponent {
constructor() {
super()
this.resetState(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
font-family: Consolas, monospace;
}

.CodeMirror-scroll {
// flex: 1;
}

.ReactCodeMirror {
position: relative;
flex: 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class HashContent extends BaseContent {

render() {
return (<SplitPane
minSize="80"
minSize={80}
split="vertical"
ref="node"
defaultSize={this.props.contentBarWidth}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class ListContent extends BaseContent {

render() {
return (<SplitPane
minSize="80"
minSize={80}
split="vertical"
ref="node"
defaultSize={this.props.contentBarWidth}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class SetContent extends BaseContent {
render() {
return (<SplitPane
className="pane-group"
minSize="80"
minSize={80}
split="vertical"
ref="node"
defaultSize={this.props.contentBarWidth}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class ZSetContent extends BaseContent {

render() {
return (<SplitPane
minSize="80"
minSize={80}
split="vertical"
ref="node"
defaultSize={this.props.contentBarWidth}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react'

require('./index.scss')

class Content extends React.Component {
class Content extends React.PureComponent {
constructor() {
super()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import splitargs from 'redis-splitargs'

require('./index.scss')

class Terminal extends React.Component {
class Terminal extends React.PureComponent {
constructor() {
super()
this.onSelectBinded = this.onSelect.bind(this)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Terminal from './components/Terminal'
import Config from './components/Config'
import Footer from './components/Footer'

class Content extends React.Component {
class Content extends React.PureComponent {
constructor() {
super()
this.state = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import KeyBrowser from './components/KeyBrowser'
import Content from './components/Content'
require('./index.scss')

class Database extends React.Component {
class Database extends React.PureComponent {
constructor() {
super()
this.$window = $(window)
Expand Down Expand Up @@ -46,8 +46,8 @@ class Database extends React.Component {
render() {
return (<SplitPane
className="pane-group"
minSize="250"
split="vertical"
minSize={250}
defaultSize={260}
ref="node"
onChange={size => {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "GUI for Redis",
"productName": "Medis",
"version": "0.6.1",
"electronVersion": "1.6.2",
"electronVersion": "1.4.15",
"license": "MIT",
"author": "luin <[email protected]> (http://zihua.li)",
"main": "server/main.js",
Expand Down Expand Up @@ -71,7 +71,7 @@
"conventional-github-releaser": "^0.5.3",
"css-loader": "^0.19.0",
"cz-conventional-changelog": "^1.1.5",
"electron": "1.5.1",
"electron": "1.4.15",
"electron-osx-sign": "^0.4.4",
"electron-packager": "^8.6.0",
"eslint-config-xo": "^0.18.1",
Expand Down
2 changes: 1 addition & 1 deletion patternManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -46260,7 +46260,7 @@
var _Utils = __webpack_require__(260);

var setSize = (0, _Utils.createAction)('SET_SIZE', function (type, value) {
return { type: type, value: value };
return { type: type, value: Number(value) };
});
exports.setSize = setSize;

Expand Down

0 comments on commit 7191ffd

Please sign in to comment.