Skip to content

Commit f9c38f6

Browse files
committed
add additional safeguards
1 parent a080557 commit f9c38f6

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

packages/web/src/components/request-workspace/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export { ParamsPanel } from './panels/params';
1515
export {
1616
DraftHeader,
1717
ErrorBanner,
18-
KeyValueRow,
1918
KeyValueTable
2019
} from './panels/shared';
2120

packages/web/src/components/request-workspace/panels/body/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ export function BodyPanel(props: BodyPanelProps) {
1717
<p>{props.requestBodySummary.description}</p>
1818
</Show>
1919

20-
<Switch>
20+
<Switch
21+
fallback={
22+
<p class="font-mono text-xs text-base-content/70">
23+
Unsupported body kind: {props.requestBodySummary.kind}
24+
</p>
25+
}
26+
>
2127
<Match when={props.requestBodySummary.kind === 'inline'}>
2228
<InlineBodyEditor
2329
hasRequest={props.hasRequest}

packages/web/src/components/request-workspace/panels/shared/error-banner.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ export function ErrorBanner(props: ErrorBannerProps) {
88
return (
99
<Show when={props.message}>
1010
{(message) => (
11-
<div class="rounded-box border border-error/35 bg-error/10 px-2 py-1.5 text-xs text-base-content">
11+
<div
12+
role="alert"
13+
class="rounded-box border border-error/35 bg-error/10 px-2 py-1.5 text-xs text-base-content"
14+
>
1215
{message()}
1316
</div>
1417
)}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export { DraftHeader } from './draft-header';
22
export { ErrorBanner } from './error-banner';
3-
export { KeyValueRow, KeyValueTable } from './key-value-table';
3+
export { KeyValueTable } from './key-value-table';

packages/web/src/components/request-workspace/panels/shared/key-value-table.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@ import { Index, Show } from 'solid-js';
22
import type { RequestDetailsRow } from '../../../../utils/request-details';
33

44
interface KeyValueRowProps {
5-
item: () => RequestDetailsRow;
5+
item: RequestDetailsRow;
66
index: number;
77
hasRequest: boolean;
88
isSaving: boolean;
99
onChange: (index: number, field: 'key' | 'value', value: string) => void;
1010
onRemove: (index: number) => void;
1111
}
1212

13-
export function KeyValueRow(props: KeyValueRowProps) {
13+
function KeyValueRow(props: KeyValueRowProps) {
1414
return (
1515
<tr>
1616
<td>
1717
<input
1818
type="text"
1919
class="input input-xs w-full border-base-300 bg-base-100 font-mono text-xs"
20-
value={props.item().key}
20+
value={props.item.key}
2121
onInput={(event) => props.onChange(props.index, 'key', event.currentTarget.value)}
2222
disabled={!props.hasRequest || props.isSaving}
2323
/>
@@ -26,7 +26,7 @@ export function KeyValueRow(props: KeyValueRowProps) {
2626
<input
2727
type="text"
2828
class="input input-xs w-full border-base-300 bg-base-100 font-mono text-xs"
29-
value={props.item().value}
29+
value={props.item.value}
3030
onInput={(event) => props.onChange(props.index, 'value', event.currentTarget.value)}
3131
disabled={!props.hasRequest || props.isSaving}
3232
/>
@@ -79,7 +79,7 @@ export function KeyValueTable(props: KeyValueTableProps) {
7979
<Index each={props.items}>
8080
{(item, index) => (
8181
<KeyValueRow
82-
item={item}
82+
item={item()}
8383
index={index}
8484
hasRequest={props.hasRequest}
8585
isSaving={props.isSaving}

0 commit comments

Comments
 (0)