Skip to content

Commit

Permalink
Fix missing useId import (#2411)
Browse files Browse the repository at this point in the history
Co-authored-by: Rohan <[email protected]>
  • Loading branch information
piatrashkakanstantinas and r100-stack authored Jan 22, 2025
1 parent 200d483 commit c34473a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cool-pants-greet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@itwin/itwinui-react': patch
---

Fixed `Panels.Trigger` not working in older React versions where `useId` is not available.
3 changes: 2 additions & 1 deletion packages/itwinui-react/src/core/Panels/Panels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
useWarningLogger,
useLayoutEffect,
useLatestRef,
useId,
} from '../../utils/index.js';
import type { PolymorphicForwardRefComponent } from '../../utils/index.js';
import { IconButton } from '../Buttons/IconButton.js';
Expand Down Expand Up @@ -269,7 +270,7 @@ const PanelTrigger = (props: PanelTriggerProps) => {
} = useSafeContext(PanelsWrapperContext);
const { id: panelId } = useSafeContext(PanelContext);

const fallbackId = React.useId();
const fallbackId = useId();
const triggerId = children.props.id || fallbackId;

const onClick = React.useCallback(() => {
Expand Down

0 comments on commit c34473a

Please sign in to comment.