diff options
author | 2019-03-23 14:15:57 +0100 | |
---|---|---|
committer | 2019-03-23 14:15:57 +0100 | |
commit | 0af622e6e81a5aee64f839eeadd23b4a62b3cf62 (patch) | |
tree | 0e2264b83c3f57f2850062f6b7293bf06416bb49 /src/components | |
parent | fix merge conflicts with latest develop (diff) | |
download | ferdium-app-0af622e6e81a5aee64f839eeadd23b4a62b3cf62.tar.gz ferdium-app-0af622e6e81a5aee64f839eeadd23b4a62b3cf62.tar.zst ferdium-app-0af622e6e81a5aee64f839eeadd23b4a62b3cf62.zip |
refactor state management for workspace feature
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/layout/AppLayout.js | 4 | ||||
-rw-r--r-- | src/components/services/content/ServiceView.js | 6 | ||||
-rw-r--r-- | src/components/ui/AppLoader/index.js | 4 |
3 files changed, 8 insertions, 6 deletions
diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js index 4dd5ff686..0c72c1413 100644 --- a/src/components/layout/AppLayout.js +++ b/src/components/layout/AppLayout.js | |||
@@ -14,8 +14,8 @@ import ErrorBoundary from '../util/ErrorBoundary'; | |||
14 | // import globalMessages from '../../i18n/globalMessages'; | 14 | // import globalMessages from '../../i18n/globalMessages'; |
15 | 15 | ||
16 | import { isWindows } from '../../environment'; | 16 | import { isWindows } from '../../environment'; |
17 | import { workspacesState } from '../../features/workspaces/state'; | ||
18 | import WorkspaceSwitchingIndicator from '../../features/workspaces/components/WorkspaceSwitchingIndicator'; | 17 | import WorkspaceSwitchingIndicator from '../../features/workspaces/components/WorkspaceSwitchingIndicator'; |
18 | import { workspaceStore } from '../../features/workspaces'; | ||
19 | 19 | ||
20 | function createMarkup(HTMLString) { | 20 | function createMarkup(HTMLString) { |
21 | return { __html: HTMLString }; | 21 | return { __html: HTMLString }; |
@@ -53,7 +53,7 @@ const styles = theme => ({ | |||
53 | width: `calc(100% + ${theme.workspaceDrawerWidth}px)`, | 53 | width: `calc(100% + ${theme.workspaceDrawerWidth}px)`, |
54 | transition: 'transform 0.5s ease', | 54 | transition: 'transform 0.5s ease', |
55 | transform() { | 55 | transform() { |
56 | return workspacesState.isWorkspaceDrawerOpen ? 'translateX(0)' : `translateX(-${theme.workspaceDrawerWidth}px)`; | 56 | return workspaceStore.isWorkspaceDrawerOpen ? 'translateX(0)' : `translateX(-${theme.workspaceDrawerWidth}px)`; |
57 | }, | 57 | }, |
58 | }, | 58 | }, |
59 | }); | 59 | }); |
diff --git a/src/components/services/content/ServiceView.js b/src/components/services/content/ServiceView.js index ada920cb6..13148b9b3 100644 --- a/src/components/services/content/ServiceView.js +++ b/src/components/services/content/ServiceView.js | |||
@@ -35,12 +35,13 @@ export default @observer class ServiceView extends Component { | |||
35 | 35 | ||
36 | autorunDisposer = null; | 36 | autorunDisposer = null; |
37 | 37 | ||
38 | forceRepaintTimeout = null; | ||
39 | |||
38 | componentDidMount() { | 40 | componentDidMount() { |
39 | this.autorunDisposer = autorun(() => { | 41 | this.autorunDisposer = autorun(() => { |
40 | if (!this.isMounted) return; | ||
41 | if (this.props.service.isActive) { | 42 | if (this.props.service.isActive) { |
42 | this.setState({ forceRepaint: true }); | 43 | this.setState({ forceRepaint: true }); |
43 | setTimeout(() => { | 44 | this.forceRepaintTimeout = setTimeout(() => { |
44 | this.setState({ forceRepaint: false }); | 45 | this.setState({ forceRepaint: false }); |
45 | }, 100); | 46 | }, 100); |
46 | } | 47 | } |
@@ -49,6 +50,7 @@ export default @observer class ServiceView extends Component { | |||
49 | 50 | ||
50 | componentWillUnmount() { | 51 | componentWillUnmount() { |
51 | this.autorunDisposer(); | 52 | this.autorunDisposer(); |
53 | clearTimeout(this.forceRepaintTimeout); | ||
52 | } | 54 | } |
53 | 55 | ||
54 | updateTargetUrl = (event) => { | 56 | updateTargetUrl = (event) => { |
diff --git a/src/components/ui/AppLoader/index.js b/src/components/ui/AppLoader/index.js index 61053f6d1..b0c7fed7b 100644 --- a/src/components/ui/AppLoader/index.js +++ b/src/components/ui/AppLoader/index.js | |||
@@ -23,11 +23,11 @@ export default @injectSheet(styles) @withTheme class AppLoader extends Component | |||
23 | static propTypes = { | 23 | static propTypes = { |
24 | classes: PropTypes.object.isRequired, | 24 | classes: PropTypes.object.isRequired, |
25 | theme: PropTypes.object.isRequired, | 25 | theme: PropTypes.object.isRequired, |
26 | } | 26 | }; |
27 | 27 | ||
28 | state = { | 28 | state = { |
29 | step: 0, | 29 | step: 0, |
30 | } | 30 | }; |
31 | 31 | ||
32 | interval = null; | 32 | interval = null; |
33 | 33 | ||