Skip to content

Commit d615fc9

Browse files
committed
fixed index issue with slider
1 parent 44d98c3 commit d615fc9

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/app/components/Slider.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class mainSlider extends Component {
3838
max={this.props.snapshotLength-1}
3939
value = {this.props.snapshotIndex}
4040
onChange={(index) => {
41+
index = index === -1 ? 0 : index;
4142
this.props.handleChangeSnapshot(index)
4243
}}
4344
handle={handle}

src/app/containers/MainContainer.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ class MainContainer extends Component {
4444

4545
emptySnapshot() {
4646
const { port } = this.state;
47-
this.setState({ snapshots: [] });
48-
port.postMessage({ action: 'emptySnap', payload: [] });
47+
this.setState({ snapshots: [] , snapshotIndex: 0 });
48+
port.postMessage({ action: 'emptySnap'});
4949
}
5050

5151
// change the snapshot index
@@ -88,7 +88,7 @@ class MainContainer extends Component {
8888

8989
render() {
9090
const { snapshots, snapshotIndex } = this.state;
91-
91+
9292
return (
9393
<div className="main-container">
9494
main-conatiner

src/app/containers/TravelContainer.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class TravelContainer extends Component {
1919
handleChangeSnapshot = {this.props.handleChangeSnapshot}
2020
snapshotIndex = {this.props.snapshotIndex}
2121
/>
22-
{`snapshot inex in slider ${this.props.snapshotIndex}`}
22+
{`travelContainer snapshotIndex ${this.props.snapshotIndex}`}
2323
</div>
2424
)
2525

src/extension/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ let snapshotArr = [];
88
// establishing connection with devtools
99
chrome.runtime.onConnect.addListener((port) => {
1010
bg = port;
11-
bg.postMessage({ from: 'background.js', message: 'established connection', date: Date.now() });
11+
// bg.postMessage({ from: 'background.js', message: 'established connection', date: Date.now() });
1212

1313
// if snapshots were saved in the snapshotArr,
1414
// send it to devtools as soon as connection to devtools is made

0 commit comments

Comments
 (0)