Skip to content

Commit

Permalink
fix(Popover): use useRandomId hook instead of React.useId directly
Browse files Browse the repository at this point in the history
Some folks haven't migrated to React 18 yet, so we must continue to use
our useRandomId hook instead of React.useId directly.

Slack: https://skypicker.slack.com/archives/C7T7QG7M5/p1700834303233829
  • Loading branch information
RobinCsl authored and oreqizer committed Nov 24, 2023
1 parent 93e6594 commit 3b49d18
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/orbit-components/src/Popover/index.tsx
Expand Up @@ -5,6 +5,7 @@ import * as React from "react";
import useStateWithTimeout from "../hooks/useStateWithTimeout";
import { PLACEMENTS } from "../common/consts";
import PopoverContent from "./components/ContentWrapper";
import useRandomId from "../hooks/useRandomId";
import Portal from "../Portal";
import handleKeyDown from "../utils/handleKeyDown";
import type { Props } from "./types";
Expand Down Expand Up @@ -34,7 +35,7 @@ const Popover = ({
dataTest,
}: Props) => {
const ref = React.useRef<HTMLDivElement | null>(null);
const popoverId = React.useId();
const popoverId = useRandomId();

const [shown, setShown, setShownWithTimeout, clearShownTimeout] = useStateWithTimeout<boolean>(
false,
Expand Down

0 comments on commit 3b49d18

Please sign in to comment.