Closed mathieudutour closed 5 years ago
Good catch.
Your change looks good. Just wondering if we need to reset more from state if we're detecting that no projects are available. I'm having many dependencies
in state but onboarding is brand-new
.
I'll double check if this will also happen after having a blank state then create a project in Guppy and remove the project in explorer.
Update
I've checked it with a blank state and the dependency for the old project still exists. It's not critical but I think we should clean this as well.
Adding REFRESH_PROJECTS_FINISH
case to dependency.reducer
to filter the dependency state based on action.projects
should work. Something like this:
case REFRESH_PROJECTS_FINISH: {
// check if project still exists
return produce(state, draftState => {
const depIds = Object.keys(draftState)
const ids = Object.keys(action.projects)
depIds.forEach(id => {
if (ids.indexOf(id) === -1) {
// project removed
delete draftState[id];
}
});
});
}
Screenshot (with-out dependency refresh check)
Good point, fixed
If you delete the entire projects folder, guppy will end up in a weird state where we show an empty sidebar.
This makes sure that if the onboarding state expect at least one project and that there is none, it gets reset