Skip to content

Commit

Permalink
fixing UI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miguel-crespo-fdc committed Oct 15, 2024
1 parent 65aaed9 commit 7e38be7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions services/frontend-service/src/ui/utils/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -990,8 +990,12 @@ export const sortLocks = (displayLocks: DisplayLock[], sorting: 'oldestToNewest'
};

// returns the release number {$version} of {$application}
export const useRelease = (application: string, version: number): Release | undefined =>
useAppDetailsForApp(application).application?.releases.find((r) => r.version === version);
export const useRelease = (application: string, version: number): Release | undefined => {
const appDetails = useAppDetailsForApp(application);

if (!appDetails) return undefined;
return appDetails.application?.releases.find((r) => r.version === version);
};

export const useReleaseOrLog = (application: string, version: number): Release | undefined => {
const release = useRelease(application, version);
Expand Down Expand Up @@ -1081,7 +1085,7 @@ export const useCurrentlyExistsAtGroup = (application: string): EnvironmentGroup
// Get all releases for an app
export const useReleasesForApp = (app: string): Release[] => {
const appDetails = useAppDetailsForApp(app);
if (!appDetails.application?.releases) {
if (!appDetails?.application?.releases) {
return [];
} else {
return appDetails.application?.releases;
Expand Down

0 comments on commit 7e38be7

Please sign in to comment.