Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1976720

Browse files
committed
fix: updates for PR review
1 parent 25c7d3c commit 1976720

File tree

3 files changed

+14
-35
lines changed

3 files changed

+14
-35
lines changed

site/src/components/MultiSelectCombobox/MultiSelectCombobox.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,13 @@ export const MultiSelectCombobox = forwardRef<
205205
const [isLoading, setIsLoading] = useState(false);
206206
const dropdownRef = useRef<HTMLDivElement>(null);
207207

208-
const getInitialSelectedOptions = () => {
209-
if (arrayDefaultOptions && arrayDefaultOptions.length > 0) {
210-
return arrayDefaultOptions;
211-
}
212-
return [];
213-
};
214-
215208
const [selected, setSelected] = useState<Option[]>(
216-
getInitialSelectedOptions,
209+
() => {
210+
if (arrayDefaultOptions && arrayDefaultOptions.length > 0) {
211+
return arrayDefaultOptions;
212+
}
213+
return [];
214+
}
217215
);
218216
const [options, setOptions] = useState<GroupOption>(
219217
transitionToGroupOption(arrayDefaultOptions, groupBy),

site/src/hooks/useWebsocket.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,13 @@ export function useWebSocket<T>(
2121
setConnectionStatus("connecting");
2222

2323
ws.onopen = () => {
24-
// console.log("Connected to WebSocket");
2524
setConnectionStatus("connected");
2625
ws.send(JSON.stringify({}));
2726
};
2827

2928
ws.onmessage = (event) => {
3029
try {
3130
const data: T = JSON.parse(event.data);
32-
// console.log("Received message:", data);
3331
setMessage(data);
3432
} catch (err) {
3533
console.error("Invalid JSON from server: ", event.data);
@@ -42,9 +40,6 @@ export function useWebSocket<T>(
4240
};
4341

4442
ws.onclose = (event) => {
45-
// console.log(
46-
// `WebSocket closed with code ${event.code}. Reason: ${event.reason}`,
47-
// );
4843
setConnectionStatus("disconnected");
4944
};
5045
} catch (error) {

site/src/pages/CreateWorkspacePage/CreateWorkspacePageViewExperimental.tsx

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export const CreateWorkspacePageViewExperimental: FC<
209209
parameters,
210210
]);
211211

212-
const [debouncedTimer, setDebouncedTimer] = useState<NodeJS.Timeout | null>(
212+
const [debouncedTimer, setDebouncedTimer] = useState<ReturnType<typeof setTimeout> | null>(
213213
null,
214214
);
215215

@@ -226,15 +226,9 @@ export const CreateWorkspacePageViewExperimental: FC<
226226

227227
// Create the request object
228228
const createRequest = () => {
229-
// Convert the rich_parameter_values array to a key-value object
230-
const newInputs = (form.values.rich_parameter_values ?? []).reduce(
231-
(acc, param) => {
232-
acc[param.name] = param.value;
233-
return acc;
234-
},
235-
{} as Record<string, string>,
236-
);
237-
229+
const newInputs = Object.fromEntries(form.values.rich_parameter_values?.map(value => {
230+
return [value.name, value.value]
231+
}) ?? []);
238232
// Update the input for the changed parameter
239233
newInputs[parameter.name] = value;
240234

@@ -274,7 +268,6 @@ export const CreateWorkspacePageViewExperimental: FC<
274268
};
275269
}, [debouncedTimer]);
276270

277-
// TODO: display top level diagnostics
278271
return (
279272
<>
280273
<div className="absolute sticky top-5 ml-10">
@@ -458,22 +451,16 @@ export const CreateWorkspacePageViewExperimental: FC<
458451
selectedOption={presetOptions[selectedPresetIndex]}
459452
/>
460453
</div>
461-
<div
462-
css={{
463-
display: "flex",
464-
alignItems: "center",
465-
gap: "8px",
466-
}}
467-
>
454+
<span className="flex items-center gap-3">
468455
<Switch
469456
id="show-preset-parameters"
470457
checked={showPresetParameters}
471458
onCheckedChange={setShowPresetParameters}
472459
/>
473-
<label htmlFor="show-preset-parameters">
460+
<Label htmlFor="show-preset-parameters">
474461
Show preset parameters
475-
</label>
476-
</div>
462+
</Label>
463+
</span>
477464
</div>
478465
</Stack>
479466
)}
@@ -508,7 +495,6 @@ export const CreateWorkspacePageViewExperimental: FC<
508495
}
509496
disabled={isDisabled}
510497
isPreset={isPresetParameter}
511-
// parameterAutofill={autofillByName[parameter.name]} TODO: handle autofill
512498
/>
513499
);
514500
})}

0 commit comments

Comments
 (0)