Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

account for null in camera select

Brendan Allan043318bcc9c4
diff --git a/apps/desktop/src/routes/(window-chrome)/(main).tsx b/apps/desktop/src/routes/(window-chrome)/(main).tsx
index 9d09e217b..5a1212957 100644
--- a/apps/desktop/src/routes/(window-chrome)/(main).tsx
+++ b/apps/desktop/src/routes/(window-chrome)/(main).tsx
@@ -398,7 +398,7 @@ function CameraSelect(props: {
return (
<div class="flex flex-col gap-[0.25rem] items-stretch text-[--text-primary]">
<label class="text-[--text-tertiary] text-[0.875rem]">Camera</label>
- <KSelect<Option>
+ <KSelect<Option | null>
options={selectOptions()}
optionValue="name"
optionTextValue="name"
@@ -409,7 +409,7 @@ function CameraSelect(props: {
itemComponent={(props) => (
<MenuItem<typeof KSelect.Item> as={KSelect.Item} item={props.item}>
<KSelect.ItemLabel class="flex-1">
- {props.item.rawValue.name}
+ {props.item.rawValue?.name}
</KSelect.ItemLabel>
</MenuItem>
)}
@@ -425,8 +425,8 @@ function CameraSelect(props: {
>
<KSelect.Trigger class="flex flex-row items-center h-[2rem] px-[0.375rem] gap-[0.375rem] border rounded-lg border-gray-200 w-full disabled:text-gray-400 transition-colors KSelect">
<IconCapCamera class="text-gray-400 size-[1.25rem]" />
- <KSelect.Value<Option> class="flex-1 text-left truncate">
- {(state) => <span>{state.selectedOption().name}</span>}
+ <KSelect.Value<Option | null> class="flex-1 text-left truncate">
+ {(state) => <span>{state.selectedOption()?.name}</span>}
</KSelect.Value>
<TargetSelectInfoPill
value={props.options?.cameraLabel ?? null}