Skip to content

Commit

Permalink
fix(designer): Combobox to check if string is also empty before using…
Browse files Browse the repository at this point in the history
… custom editor (#4818)

small fix

Co-authored-by: Travis Harris <hartra344@users.noreply.github.com>
  • Loading branch information
Eric-B-Wu and hartra344 committed May 9, 2024
1 parent 6db46d4 commit 949deb6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions libs/designer-ui/src/lib/combobox/index.tsx
Expand Up @@ -9,6 +9,7 @@ import { SelectableOptionMenuItemType, ComboBox } from '@fluentui/react';
import { Button, Spinner, Tooltip } from '@fluentui/react-components';
import { bundleIcon, Dismiss24Filled, Dismiss24Regular } from '@fluentui/react-icons';
import { getIntl } from '@microsoft/logic-apps-shared';
import { isEmptySegments } from '../editor/base/utils/parsesegments';
import { useRef, useState, useCallback, useMemo, useEffect } from 'react';
import type { FormEvent } from 'react';
import { useIntl } from 'react-intl';
Expand Down Expand Up @@ -362,15 +363,13 @@ const getMode = (selectedKey: string, selectedKeys: string[], initialValue: Valu
}
if (selectedKeys.length > 0) {
for (const key of selectedKeys) {
const hasValue = initialValue.length > 0 && initialValue[0].value;
if (hasValue && !key) {
if (!isEmptySegments(initialValue) && !key) {
return Mode.Custom;
}
}
return Mode.Default;
}
const hasValue = initialValue.length > 0 && initialValue[0].value;
return hasValue ? (selectedKey ? Mode.Default : Mode.Custom) : Mode.Default;
return isEmptySegments(initialValue) ? Mode.Default : selectedKey ? Mode.Default : Mode.Custom;
};

const getSelectedKey = (options: ComboboxItem[], initialValue?: ValueSegment[], isLoading?: boolean): string => {
Expand Down

0 comments on commit 949deb6

Please sign in to comment.