Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: DH-16336: usePickerWithSelectedValues - boolean flags should be calculated based on trimmed search text #1750

Merged
merged 4 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/components/src/modal/DebouncedModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function DebouncedModal({
debounceMs,
isOpen = false,
}: DebouncedModalProps): JSX.Element {
const debouncedIsOpen = useDebouncedValue(isOpen, debounceMs);
const { value: debouncedIsOpen } = useDebouncedValue(isOpen, debounceMs);

return (
<>
Expand Down
5 changes: 4 additions & 1 deletion packages/jsapi-components/src/useCheckIfExistsValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ export function useCheckIfExistsValue(
const tableUtils = useTableUtils();

const [valueTrimmed, setValueTrimmed] = useState('');
const valueTrimmedDebounced = useDebouncedValue(valueTrimmed, debounceMs);
const { value: valueTrimmedDebounced } = useDebouncedValue(
valueTrimmed,
debounceMs
);

const trimAndUpdateValue = useCallback((text: string) => {
setValueTrimmed(text.trim());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ const mockViewportData =
createMockProxy<WindowedListData<KeyedItem<unknown>>>();

const mockSelection = {
useDebounceValueResult: { selection: new Set('a'), isInverted: true },
useDebounceValueResult: {
isDebouncing: false,
value: { selection: new Set('a'), isInverted: true },
},
useIsEqualMemoResult: { selection: new Set('b'), isInverted: true },
useMappedSelectionResult: { selection: new Set('c'), isInverted: true },
} as const;
Expand Down Expand Up @@ -96,7 +99,7 @@ it('should memoize debounced selection based on value equality', () => {
renderHook(() => useDebouncedViewportSelectionFilter(options));

expect(useIsEqualMemo).toHaveBeenCalledWith(
mockSelection.useDebounceValueResult,
mockSelection.useDebounceValueResult.value,
isSelectionMaybeInvertedEqual
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function useDebouncedViewportSelectionFilter<TItem, TValue>({

// Debounce so user can rapidly select multiple items in a row without the
// cost of updating the table on each change
const debouncedValuesSelection = useDebouncedValue(
const { value: debouncedValuesSelection } = useDebouncedValue(
valuesSelection,
DEBOUNCE_MS
);
Expand Down
Loading
Loading