Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
logging-scratch-gui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Goessmann
logging-scratch-gui
Commits
5a9679fa
Commit
5a9679fa
authored
7 years ago
by
Paul Kaplan
Browse files
Options
Downloads
Patches
Plain Diff
Don't use bind in mapStateToProps
parent
8747315a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/containers/load-button.jsx
+6
-7
6 additions, 7 deletions
src/containers/load-button.jsx
src/containers/save-button.jsx
+6
-8
6 additions, 8 deletions
src/containers/save-button.jsx
with
12 additions
and
15 deletions
src/containers/load-button.jsx
+
6
−
7
View file @
5a9679fa
...
...
@@ -14,12 +14,9 @@ class LoadButton extends React.Component {
'
handleClick
'
]);
}
shouldComponentUpdate
()
{
return
false
;
}
handleChange
(
e
)
{
const
reader
=
new
FileReader
();
reader
.
onload
=
()
=>
this
.
props
.
loadProject
(
reader
.
result
);
reader
.
onload
=
()
=>
this
.
props
.
vm
.
fromJSON
(
reader
.
result
);
reader
.
readAsText
(
e
.
target
.
files
[
0
]);
}
handleClick
()
{
...
...
@@ -30,7 +27,7 @@ class LoadButton extends React.Component {
}
render
()
{
const
{
loadProject
,
// eslint-disable-line no-unused-vars
vm
,
// eslint-disable-line no-unused-vars
...
props
}
=
this
.
props
;
return
(
...
...
@@ -45,11 +42,13 @@ class LoadButton extends React.Component {
}
LoadButton
.
propTypes
=
{
loadProject
:
PropTypes
.
func
.
isRequired
vm
:
PropTypes
.
shape
({
fromJSON
:
PropTypes
.
func
})
};
const
mapStateToProps
=
state
=>
({
loadProject
:
state
.
vm
.
fromJSON
.
bind
(
state
.
vm
)
vm
:
state
.
vm
});
export
default
connect
(
...
...
This diff is collapsed.
Click to expand it.
src/containers/save-button.jsx
+
6
−
8
View file @
5a9679fa
...
...
@@ -14,11 +14,8 @@ class SaveButton extends React.Component {
'
handleClick
'
]);
}
shouldComponentUpdate
()
{
return
false
;
}
handleClick
()
{
const
json
=
this
.
props
.
saveProjectSb3
();
const
json
=
this
.
props
.
vm
.
saveProjectSb3
();
// Download project data into a file - create link element,
// simulate click on it, and then remove it.
...
...
@@ -39,7 +36,7 @@ class SaveButton extends React.Component {
}
render
()
{
const
{
saveProjectSb3
,
// eslint-disable-line no-unused-vars
vm
,
// eslint-disable-line no-unused-vars
...
props
}
=
this
.
props
;
return
(
...
...
@@ -60,11 +57,12 @@ class SaveButton extends React.Component {
}
SaveButton
.
propTypes
=
{
saveProjectSb3
:
PropTypes
.
func
.
isRequired
};
vm
:
PropTypes
.
shape
({
saveProjectSb3
:
PropTypes
.
func
})};
const
mapStateToProps
=
state
=>
({
saveProjectSb3
:
state
.
vm
.
saveProjectSb3
.
bind
(
state
.
vm
)
vm
:
state
.
vm
});
export
default
connect
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment