git-watchtower 1.9.15 → 1.9.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-watchtower",
3
- "version": "1.9.15",
3
+ "version": "1.9.17",
4
4
  "description": "Terminal-based Git branch monitor with activity sparklines and optional dev server with live reload",
5
5
  "main": "bin/git-watchtower.js",
6
6
  "bin": {
@@ -355,7 +355,7 @@ class Store {
355
355
  */
356
356
  addLog(message, type = 'info', maxEntries = 10) {
357
357
  const entry = { message, type, timestamp: new Date() };
358
- const activityLog = [...this.state.activityLog, entry].slice(-maxEntries);
358
+ const activityLog = [entry, ...this.state.activityLog].slice(0, maxEntries);
359
359
  this.setState({ activityLog });
360
360
  }
361
361
 
@@ -367,7 +367,7 @@ class Store {
367
367
  */
368
368
  addToHistory(from, to, maxEntries = 20) {
369
369
  const entry = { from, to, timestamp: new Date() };
370
- const switchHistory = [...this.state.switchHistory, entry].slice(-maxEntries);
370
+ const switchHistory = [entry, ...this.state.switchHistory].slice(0, maxEntries);
371
371
  this.setState({ switchHistory });
372
372
  }
373
373
 
@@ -377,14 +377,14 @@ class Store {
377
377
  */
378
378
  getLastSwitch() {
379
379
  const history = this.state.switchHistory;
380
- return history.length > 0 ? history[history.length - 1] : null;
380
+ return history.length > 0 ? history[0] : null;
381
381
  }
382
382
 
383
383
  /**
384
384
  * Remove the last switch from history (after undo)
385
385
  */
386
386
  popHistory() {
387
- const switchHistory = this.state.switchHistory.slice(0, -1);
387
+ const switchHistory = this.state.switchHistory.slice(1);
388
388
  this.setState({ switchHistory });
389
389
  }
390
390