Skip to content

Commit e0a85a3

Browse files
committed
Use null rather than empty string for unspecified namespace
It's possible for (arguably misformed) package metadata to have the empty string as the namespace. This can happen for example when ingesting an OCI image that does not have the correct repository URL specified. Currently guac-visualiser does not let you pick beyond a namespace that is the empty string: it would not make the "package name" dropdown sensitive (although it would correctly populate the options from the GraphQL response). This commit updates the "empty" state for the package name option from the empty string to null (like is used for version). Then update the `disabled` param to be determined on whether the namespace is null (rather than the empty string). Signed-off-by: Ed Baunton <[email protected]>
1 parent c607d8b commit e0a85a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

components/packages/packageSelector.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function PackageSelector({
2222
resetTypeFunc?: () => void;
2323
}) {
2424
const [packageType, setPackageType] = useState("");
25-
const [packageNamespace, setPackageNamespace] = useState("");
25+
const [packageNamespace, setPackageNamespace] = useState(null);
2626
const [packageName, setPackageName] = useState("");
2727
const [packageNamespaces, setPackageNamespaces] = useState(
2828
INITIAL_PACKAGE_NAMESPACES
@@ -43,7 +43,7 @@ export default function PackageSelector({
4343

4444
const resetType = () => {
4545
setPackageNamespaces(INITIAL_PACKAGE_NAMESPACES);
46-
setPackageNamespace("");
46+
setPackageNamespace(null);
4747
resetNamespace();
4848
resetTypeFunc();
4949
};
@@ -82,7 +82,7 @@ export default function PackageSelector({
8282
setPackageNameFunc={setPackageName}
8383
setPackageVersionsFunc={setPackageVersions}
8484
resetNameFunc={resetName}
85-
disabled={!packageNamespace}
85+
disabled={packageNamespace === null}
8686
/>
8787
</div>
8888
<div className="left-0 flex w-full items-end justify-center bg-gradient-to-t lg:static lg:h-auto lg:w-auto lg:bg-none">

0 commit comments

Comments
 (0)