Skip to content

Commit

Permalink
🐛 fix: fix interactive list allow reselect
Browse files Browse the repository at this point in the history
  • Loading branch information
e1en0r committed Jun 15, 2021
1 parent 4446b54 commit f86aaaf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/InteractiveGroup/useInteractiveGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export function useInteractiveGroup<

// trigger onSelect callbacks for any new selections
if (onSelect && Array.isArray(selectedIds)) {
selectedIds.forEach(id => handleSelectedId(id));
selectedIds.forEach(id => handleSelectedId(id, allowReselect));
}

// trigger the onSelect callback for a re-select if not multi-select
Expand Down
4 changes: 2 additions & 2 deletions src/compositions/InteractiveList/InteractiveList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { UncontrolledInteractiveList, UncontrolledInteractiveListProps } from '.
export type InteractiveListProps = Omit<UncontrolledInteractiveListProps, 'reducer'> &
Pick<InteractiveGroupProviderProps, 'initialSelected'>;

/** The interactive list is a managed wrapper around the unmanaged interactive list */
/** The interactive list is a wrapper around the uncontrolled interactive list */
function InteractiveListBase(
{ initialSelected, items, ...props }: InteractiveListProps,
forwardedRef: React.ForwardedRef<HTMLUListElement>,
Expand All @@ -24,7 +24,7 @@ function InteractiveListBase(

const [, dispatch] = reducer;

// this is a managed component so we must watch for items changes
// update the items in the reducer if the items change
useEffect(() => {
dispatch({
items: items || [],
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useDeepFocusGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type UseDeepFocusGroupResponse = {
addRef: <E extends HTMLElement, H extends string | undefined = undefined>(props: {
id: string;
ref: H extends string ? UseDeepFocusGroupRefWithHandle<E, H> : UseDeepFocusGroupRef<E>;
/** If passive is true then the ref is added but no focus or blur events are triggered at the time of addition */
passive?: boolean;
/** To be used with the imperative handle hook */
handle?: string;
Expand Down

0 comments on commit f86aaaf

Please sign in to comment.