Skip to content
This repository has been archived by the owner on Jul 24, 2021. It is now read-only.

Commit

Permalink
fix workspace switching
Browse files Browse the repository at this point in the history
This fixes #62.

Turns out that when you shadow the `id` parameter but don't provide a new
value in a method call you don't actually end up doing anything.

This commit fixes things by removing the shadowed id so that the `loadCurrentWorkspace()`
method does what it says on the tin.
  • Loading branch information
perigrin committed Dec 12, 2018
1 parent ce7dcb4 commit 21e80f8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/models/Workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export default id => {
const findWorkspaceById = id => workspaces().find(w => w.id === id);
const findWorkspaceByName = name => workspaces().find(w => w.name === name);

// TODO: I'm not sure this is really the right logic we should be using here
// seems that we should just throw an error if we can't find the workspace in
// question or return null or something
const loadCurrentWorkspace = id =>
// TODO: I'm not sure this is really the right logic we should be using here
// seems that we should just throw an error if we can't find the workspace in
// question or return null or something
const loadCurrentWorkspace = () =>
loadAllWorkspaces().then(() => {
let found;
if (id) found = findWorkspaceById(id);
Expand All @@ -39,7 +39,7 @@ export default id => {
);
if (!found) found = findWorkspaceByName("GLOBAL");
if (!found) found = workspaces()[0];
if (!found) return Promise.reject(id);
if (!found) return Promise.reject(id);
return currentWorkspace(found);
});

Expand Down

0 comments on commit 21e80f8

Please sign in to comment.