{"action":"created","issue":{"url":"https://api.github.com/repos/joshwcomeau/guppy/issues/184","repository_url":"https://api.github.com/repos/joshwcomeau/guppy","labels_url":"https://api.github.com/repos/joshwcomeau/guppy/issues/184/labels{/name}","comments_url":"https://api.github.com/repos/joshwcomeau/guppy/issues/184/comments","events_url":"https://api.github.com/repos/joshwcomeau/guppy/issues/184/events","html_url":"https://github.com/joshwcomeau/guppy/issues/184","id":355935781,"node_id":"MDU6SXNzdWUzNTU5MzU3ODE=","number":184,"title":"Alert users when a project can't be read","user":{"login":"joshwcomeau","id":6692932,"node_id":"MDQ6VXNlcjY2OTI5MzI=","avatar_url":"https://avatars0.githubusercontent.com/u/6692932?v=4","gravatar_id":"","url":"https://api.github.com/users/joshwcomeau","html_url":"https://github.com/joshwcomeau","followers_url":"https://api.github.com/users/joshwcomeau/followers","following_url":"https://api.github.com/users/joshwcomeau/following{/other_user}","gists_url":"https://api.github.com/users/joshwcomeau/gists{/gist_id}","starred_url":"https://api.github.com/users/joshwcomeau/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshwcomeau/subscriptions","organizations_url":"https://api.github.com/users/joshwcomeau/orgs","repos_url":"https://api.github.com/users/joshwcomeau/repos","events_url":"https://api.github.com/users/joshwcomeau/events{/privacy}","received_events_url":"https://api.github.com/users/joshwcomeau/received_events","type":"User","site_admin":false},"labels":[{"id":939204844,"node_id":"MDU6TGFiZWw5MzkyMDQ4NDQ=","url":"https://api.github.com/repos/joshwcomeau/guppy/labels/good%20first%20issue","name":"good first issue","color":"57ff5f","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-08-31T11:00:12Z","updated_at":"2018-11-17T18:35:08Z","closed_at":null,"author_association":"OWNER","body":"**Summary**\r\nWhen a project is deleted from disk, it will be silently removed from Guppy.\r\n\r\nIn many cases, this behaviour is fine; if the user deletes it with Finder/Explorer, it should naturally also disappear from Guppy. But given that this app is targeted at beginners, it might be good to throw a notice prompt up:\r\n\r\n```\r\nProject deleted\r\n\r\nYour projects Thing 1, Thing 2, and Thing 3 were deleted from disk, and have been removed from Guppy.\r\n```\r\n\r\n**Implementation**\r\nThe code that manages this is in `read-from-disk.service`, under `loadGuppyProjects`:\r\n\r\nRight now we're silently swallowing these errors.\r\n\r\nWe could throw a prompt right there in the `.catch`, but that would mean 1 prompt for every deleted project. If the user deletes 10 projects, that's a lot of prompts!\r\n\r\nInstead, we want to bubble those errors in with the results. So if we're loading 5 projects and 2 were deleted, the value passed to `results` might look like this:\r\n\r\n```js\r\n[ project1Json, Error, Error, project4Json, project5Json]\r\n```\r\n\r\nWe should split `loadGuppyProjects` up into a couple functions; one to parse the disk and return results, and then another to build a valid projects object out of it.\r\n\r\nHere's the flow I imagine, in `refresh-projects.saga.js`:\r\n\r\n```js\r\nconst pathsArray = yield select(getPathsArray);\r\n\r\nconst projectsFromDisk = yield call(loadGuppyProjects, pathsArray);\r\n// This will now be that array of mixed JSON and errors\r\n\r\nconst deletedPaths = /* some method that finds the paths in `pathsArray` that produced errors */\r\n\r\nif (deletedPaths.length > 0) {\r\n  const deletedProjectNames = /* some method that converts deletedPaths to projectNames */\r\n  \r\n  const message = /* some method to build up a nice error message, taking into account the number of projects for proper grammar */\r\n\r\n  dialog.showMessageBox({...});\r\n}\r\n```\r\n\r\nAs a bonus, this would set us up well to handle other types of errors when loading projects."},"comment":{"url":"https://api.github.com/repos/joshwcomeau/guppy/issues/comments/439638080","html_url":"https://github.com/joshwcomeau/guppy/issues/184#issuecomment-439638080","issue_url":"https://api.github.com/repos/joshwcomeau/guppy/issues/184","id":439638080,"node_id":"MDEyOklzc3VlQ29tbWVudDQzOTYzODA4MA==","user":{"login":"menor","id":1360794,"node_id":"MDQ6VXNlcjEzNjA3OTQ=","avatar_url":"https://avatars0.githubusercontent.com/u/1360794?v=4","gravatar_id":"","url":"https://api.github.com/users/menor","html_url":"https://github.com/menor","followers_url":"https://api.github.com/users/menor/followers","following_url":"https://api.github.com/users/menor/following{/other_user}","gists_url":"https://api.github.com/users/menor/gists{/gist_id}","starred_url":"https://api.github.com/users/menor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/menor/subscriptions","organizations_url":"https://api.github.com/users/menor/orgs","repos_url":"https://api.github.com/users/menor/repos","events_url":"https://api.github.com/users/menor/events{/privacy}","received_events_url":"https://api.github.com/users/menor/received_events","type":"User","site_admin":false},"created_at":"2018-11-17T18:35:08Z","updated_at":"2018-11-17T18:35:08Z","author_association":"NONE","body":"Thanks :) I will start cleaning it tomorrow then\r\nWill tag you in the PR then once it's ready."}}
{"actor":{"display_login":"menor"}}