fix: marshal convertLicenses() into a [] instead of nil (#22366)

This was a bad smell that was being addressed by the frontend. This type
was generating out to be a `nil`/`null` instead of an empty `License[]`.
Now this returns as an empty array and we can actively check if we have
no licenses with a length of `0`.
This commit is contained in:
Jake Howell
2026-02-28 00:23:41 +11:00
committed by GitHub
parent d204e6fb84
commit a51eb40dca
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -349,7 +349,7 @@ func convertLicense(dl database.License, c jwt.MapClaims) codersdk.License {
}
func convertLicenses(licenses []database.License) ([]codersdk.License, error) {
var out []codersdk.License
out := make([]codersdk.License, 0, len(licenses))
for _, l := range licenses {
c, err := decodeClaims(l)
if err != nil {
@@ -134,7 +134,7 @@ const LicensesSettingsPageView: FC<Props> = ({
</Stack>
)}
{!isLoading && licenses === null && (
{!isLoading && licenses?.length === 0 && (
<div css={styles.root}>
<Stack alignItems="center" spacing={1}>
<Stack alignItems="center" spacing={0.5}>