mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-06 12:44:30 +08:00
fix(composer): reduction in composer bootup time
This commit is contained in:
parent
b7e32b9c68
commit
8a5a0ad209
5 changed files with 12 additions and 10 deletions
|
@ -55,7 +55,7 @@ export default class ComposerView extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
this.state = {
|
this.state = {
|
||||||
showQuotedText: false,
|
showQuotedText: Utils.isForwardedMessage(props.draft),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +69,11 @@ export default class ComposerView extends React.Component {
|
||||||
if (newProps.session !== this.props.session) {
|
if (newProps.session !== this.props.session) {
|
||||||
this._receivedNewSession();
|
this._receivedNewSession();
|
||||||
}
|
}
|
||||||
|
if (Utils.isForwardedMessage(this.props.draft) !== Utils.isForwardedMessage(newProps.draft)) {
|
||||||
|
this.setState({
|
||||||
|
showQuotedText: Utils.isForwardedMessage(newProps.draft),
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
|
@ -118,10 +123,6 @@ export default class ComposerView extends React.Component {
|
||||||
this.undoManager = new UndoManager();
|
this.undoManager = new UndoManager();
|
||||||
this._saveToHistory();
|
this._saveToHistory();
|
||||||
|
|
||||||
this.setState({
|
|
||||||
showQuotedText: Utils.isForwardedMessage(this.props.draft),
|
|
||||||
});
|
|
||||||
|
|
||||||
this.props.draft.files.forEach((file) => {
|
this.props.draft.files.forEach((file) => {
|
||||||
if (Utils.shouldDisplayAsImage(file)) {
|
if (Utils.shouldDisplayAsImage(file)) {
|
||||||
Actions.fetchFile(file);
|
Actions.fetchFile(file);
|
||||||
|
|
|
@ -24,7 +24,7 @@ function InflatesDraftClientId(ComposedComponent) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
componentDidMount() {
|
||||||
this._unmounted = false;
|
this._unmounted = false;
|
||||||
this._prepareForDraft(this.props.draftClientId);
|
this._prepareForDraft(this.props.draftClientId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -170,9 +170,9 @@ class ComponentRegistry
|
||||||
# high-level components (like the <Sheet />) listen and re-render when
|
# high-level components (like the <Sheet />) listen and re-render when
|
||||||
# this triggers.
|
# this triggers.
|
||||||
#
|
#
|
||||||
# We set the debouce interval to 2 "frames" (33ms) to balance
|
# We set the debouce interval to 1 "frame" (16ms) to balance
|
||||||
# responsiveness and efficient batching.
|
# responsiveness and efficient batching.
|
||||||
triggerDebounced: _.debounce(( -> @trigger(@)), 33)
|
triggerDebounced: _.debounce(( -> @trigger(@)), 16)
|
||||||
|
|
||||||
_removeDeprecatedRoles: (displayName, roles) ->
|
_removeDeprecatedRoles: (displayName, roles) ->
|
||||||
newRoles = _.clone(roles)
|
newRoles = _.clone(roles)
|
||||||
|
|
|
@ -19,6 +19,7 @@ class SizeToFitInput extends React.Component
|
||||||
@_sizeToFit()
|
@_sizeToFit()
|
||||||
|
|
||||||
_sizeToFit: =>
|
_sizeToFit: =>
|
||||||
|
return if @props.value.length is 0
|
||||||
# Measure the width of the text in the input and
|
# Measure the width of the text in the input and
|
||||||
# resize the input field to fit.
|
# resize the input field to fit.
|
||||||
input = ReactDOM.findDOMNode(@refs.input)
|
input = ReactDOM.findDOMNode(@refs.input)
|
||||||
|
@ -33,7 +34,7 @@ class SizeToFitInput extends React.Component
|
||||||
render: =>
|
render: =>
|
||||||
<span>
|
<span>
|
||||||
<span ref="measure" style={visibility:'hidden', position: 'absolute'}></span>
|
<span ref="measure" style={visibility:'hidden', position: 'absolute'}></span>
|
||||||
<input ref="input" type="text" {...@props}/>
|
<input ref="input" type="text" style={width: 1} {...@props}/>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
select: =>
|
select: =>
|
||||||
|
|
|
@ -162,7 +162,7 @@ class Toolbar extends React.Component
|
||||||
shouldComponentUpdate: (nextProps, nextState) =>
|
shouldComponentUpdate: (nextProps, nextState) =>
|
||||||
# This is very important. Because toolbar uses ReactCSSTransitionGroup,
|
# This is very important. Because toolbar uses ReactCSSTransitionGroup,
|
||||||
# repetitive unnecessary updates can break animations and cause performance issues.
|
# repetitive unnecessary updates can break animations and cause performance issues.
|
||||||
not _.isEqual(nextProps, @props) or not _.isEqual(nextState, @state)
|
not Utils.isEqualReact(nextProps, @props) or not Utils.isEqualReact(nextState, @state)
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
style =
|
style =
|
||||||
|
|
Loading…
Add table
Reference in a new issue