-
Notifications
You must be signed in to change notification settings - Fork 559
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix selected dependencies going stale
Always fill in selected dependencies on the backend, ensuring that these are either an empty object if an app does not have dependencies, or, if it has, match the app's dependencies, both when stored and returned. Also hardens FileStore to recover from a faulty store file.
- Loading branch information
Showing
6 changed files
with
63 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Ensure selected dependencies are filled in when given the app's dependencies | ||
* (where undefined = none) and a user's selection (where undefined = default). | ||
*/ | ||
export const fillSelectedDependencies = (dependencies?: string[], selectedDependencies?: Record<string, string>) => | ||
dependencies?.reduce( | ||
(accumulator, dependencyId) => { | ||
accumulator[dependencyId] = selectedDependencies?.[dependencyId] ?? dependencyId | ||
return accumulator | ||
}, | ||
{} as Record<string, string>, | ||
) ?? {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters