Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

[WEB-5657] chore: synchronization configuration for multiple providers in authentication adapter #8409

b-saikrishnakanth46453560f2c7
diff --git a/apps/admin/core/components/common/controller-switch.tsx b/apps/admin/core/components/common/controller-switch.tsx
index 1712ca0ad5..f20d6cafe3 100644
--- a/apps/admin/core/components/common/controller-switch.tsx
+++ b/apps/admin/core/components/common/controller-switch.tsx
@@ -26,13 +26,11 @@ export function ControllerSwitch<T extends FieldValues>(props: Props<T>) {
<Controller
control={control}
name={name as FieldPath<T>}
- render={({ field: { value, onChange } }) => (
- <ToggleSwitch
- value={Boolean(parseInt(value))}
- onChange={() => (parseInt(value) ? onChange("0") : onChange("1"))}
- size="sm"
- />
- )}
+ render={({ field: { value, onChange } }) => {
+ const parsedValue = Number.parseInt(typeof value === "string" ? value : String(value ?? "0"), 10);
+ const isOn = !Number.isNaN(parsedValue) && parsedValue !== 0;
+ return <ToggleSwitch value={isOn} onChange={() => onChange(isOn ? "0" : "1")} size="sm" />;
+ }}
/>
</div>
</div>