Skip to content

Commit

Permalink
Fix/app crash deleting project folder (#53)
Browse files Browse the repository at this point in the history
* Fix app crashing issue

* Fix create empty folder
  • Loading branch information
kylebonnici authored Jul 10, 2023
1 parent a5cc74c commit 9ff9025
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 25 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ and this project adheres to
- `Restart application with verbose logging` button did not restart app
- Aborting profiling wizard would not closed dialog when device is
disconnected and we are waiting to reconnect
- App crash if profiling project is deleted while app is running
- Empty directory is created if profiling folder is deleted and app is
reopened

## 0.9.0 - 2023-06-27

Expand Down
4 changes: 2 additions & 2 deletions src/components/Profiling/ProfilingProjects/Profiles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import './profilingProjects.scss';

export default () => {
const dispatch = useDispatch();
const profiles = useSelector(getProfileProjects);
const projects = useSelector(getProfileProjects);

const [showAddProjectDialog, setShowAddProjectDialog] = useState(false);
useProfilingProjects();
Expand Down Expand Up @@ -73,7 +73,7 @@ export default () => {
</div>

<div className="d-flex flex-column-reverse">
{profiles.map(project => (
{projects.map(project => (
<React.Fragment key={project.path}>
{project.error && (
<MissingProjectSettingsCard project={project} />
Expand Down
35 changes: 13 additions & 22 deletions src/components/Profiling/ProfilingProjects/useProfilingProjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const useProfilingProjects = () => {
)
);

const unsubscribe = recentProjects.map(recentProject => {
recentProjects.forEach(recentProject => {
if (fs.existsSync(recentProject)) {
const pathObject = path.parse(recentProject);
try {
Expand All @@ -80,19 +80,16 @@ export const useProfilingProjects = () => {
name: pathObject.name,
});

// TODO See why no events come when file is changed
return store.onDidAnyChange(newSettings => {
dispatch(
updateProfilingProject({
path: recentProject,
settings: newSettings ?? undefined,
error:
newSettings === undefined
? 'fileMissing'
: undefined,
})
);
});
dispatch(
updateProfilingProject({
path: recentProject,
settings: store.store ?? undefined,
error:
store.store === undefined
? 'fileMissing'
: undefined,
})
);
} catch (error) {
dispatch(
updateProfilingProject({
Expand All @@ -101,9 +98,9 @@ export const useProfilingProjects = () => {
error: 'fileCorrupted',
})
);

return () => {};
}

return;
}

dispatch(
Expand All @@ -113,12 +110,6 @@ export const useProfilingProjects = () => {
error: 'fileMissing',
})
);

return () => {};
});

return () => {
unsubscribe.forEach(release => release());
};
}, [dispatch, recentProjects]);
};
1 change: 0 additions & 1 deletion src/features/nrfutillNpm/csvProcessing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ export const generateParamsFromCSV =
message: 'Processing has started',
progress: 0,
cancel: () => {
// TODO Ask for fix in NRF UTIL
processCSV.kill('SIGINT');
dispatch(
removeProjectProfileProgress({
Expand Down

0 comments on commit 9ff9025

Please sign in to comment.