Skip to content

Commit

Permalink
Fix primefaces#6366: ColumnFilter proper ID handling
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Apr 10, 2024
1 parent 606485a commit ea868a9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions components/lib/datatable/ColumnFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ColumnBase } from '../column/ColumnBase';
import { CSSTransition } from '../csstransition/CSSTransition';
import { Dropdown } from '../dropdown/Dropdown';
import FocusTrap from '../focustrap/FocusTrap';
import { useMergeProps, useOverlayListener, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
import { useMergeProps, useMountEffect, useOverlayListener, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
import { FilterIcon } from '../icons/filter';
import { FilterSlashIcon } from '../icons/filterslash';
import { PlusIcon } from '../icons/plus';
Expand All @@ -20,7 +20,7 @@ import { DomHandler, IconUtils, ObjectUtils, UniqueComponentId, ZIndexUtils } fr
export const ColumnFilter = React.memo((props) => {
const [overlayVisibleState, setOverlayVisibleState] = React.useState(false);
const overlayRef = React.useRef(null);
const overlayId = React.useRef(() => UniqueComponentId());
const overlayId = React.useRef(null);
const iconRef = React.useRef(null);
const selfClick = React.useRef(false);
const overlayEventListener = React.useRef(null);
Expand Down Expand Up @@ -478,6 +478,12 @@ export const ColumnFilter = React.memo((props) => {
}
});

useMountEffect(() => {
if (!overlayId.current) {
overlayId.current = UniqueComponentId();
}
});

useUnmountEffect(() => {
if (overlayEventListener.current) {
OverlayService.off('overlay-click', overlayEventListener.current);
Expand Down

0 comments on commit ea868a9

Please sign in to comment.