Skip to content

Commit

Permalink
fix(Copr): Handle built_packages being null
Browse files Browse the repository at this point in the history
The API definition did not take `null` for `built_packages` and thus
never showed an issue with the code. This change fixes both the type
and the issue itself.
  • Loading branch information
Venefilyn committed Nov 18, 2024
1 parent 6db9ab2 commit bf6b2dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion frontend/src/apiDefinitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export interface CoprBuild {
build_logs_url: string;
build_start_time: number;
build_submitted_time: number;
built_packages: CoprBuildPackage[];
built_packages: CoprBuildPackage[] | null;
chroot: string;
commit_sha: string;
copr_owner: string;
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/copr/CoprBuild.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export const CoprBuild = () => {
const [packagesToInstall, setPackagesToInstall] = useState<string[]>([]);

useEffect(() => {
if (data) setPackagesToInstall(getPackagesToInstall(data.built_packages));
if (data?.built_packages)
setPackagesToInstall(getPackagesToInstall(data.built_packages));
}, [data?.built_packages]);

// If backend API is down
Expand Down

0 comments on commit bf6b2dd

Please sign in to comment.