Skip to content

Commit

Permalink
fix: default setActive() to write cache files
Browse files Browse the repository at this point in the history
Given legacy code which called `setActive()` with no arguments, we
should also default to the old behavior of active mode writing out cache
files.

The broken case is when the shared store was instantiated not active,
then `.setActive()` was called later with no arguments
  • Loading branch information
dbushong committed Sep 17, 2018
1 parent 5c86e2e commit 70fb4ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/shared-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ SharedStore = (function(superClass) {

SharedStore.prototype.setActive = function(isActive) {
if (isActive == null) {
isActive = true;
isActive = {
writeCacheFiles: true
};
}
this._active = !!isActive;
if (isActive && typeof isActive.writeCacheFiles === 'boolean') {
Expand Down
2 changes: 1 addition & 1 deletion src/shared-store.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class SharedStore extends EventEmitter
@_writeCacheFiles = !!@_active
@_retryTimeout = TEN_SECONDS

setActive: (isActive = true) ->
setActive: (isActive = { writeCacheFiles: true }) ->
@_active = !!isActive
if isActive && typeof isActive.writeCacheFiles == 'boolean'
@_writeCacheFiles = isActive.writeCacheFiles
Expand Down

0 comments on commit 70fb4ea

Please sign in to comment.