Skip to content

Commit

Permalink
useId should be the fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
sndrs committed May 24, 2024
1 parent b3202ef commit 3af3c6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/client/components/CheckboxInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ export const CheckboxInput = ({
cssOverrides,
onToggle,
}: CheckboxInputProps): EmotionJSX.Element => {
const switchName = id ?? useId();
const defaultId = useId();
const switchName = id ?? defaultId;
const labelId = descriptionId(switchName);

return (
Expand Down
3 changes: 2 additions & 1 deletion src/client/components/ToggleSwitchInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ export const ToggleSwitchInput = ({
imagePath,
cssOverrides,
}: ToggleSwitchInputProps): EmotionJSX.Element => {
const switchName = id ?? useId();
const defaultId = useId();
const switchName = id ?? defaultId;
const labelId = descriptionId(switchName);

return (
Expand Down

0 comments on commit 3af3c6e

Please sign in to comment.