Skip to content
Snippets Groups Projects
Unverified Commit e7bfd35b authored by Matiss Janis Aboltins's avatar Matiss Janis Aboltins Committed by GitHub
Browse files

:sparkles: (autocomplete) enable new version for dev/preview deploys (#789)

Enabling the new autocomplete for dev/preview deployments.

This will allow us to spot any more issues there might be before we
release the new autocomplete.

https://github.com/actualbudget/actual/issues/773
parent 1df7acdc
No related branches found
No related tags found
No related merge requests found
......@@ -442,6 +442,7 @@ export default function ScheduleDetails() {
<FormLabel title="Payee" htmlFor="payee-field" />
<PayeeAutocomplete
value={state.fields.payee}
inputId="payee-field"
inputProps={{ id: 'payee-field', placeholder: '(none)' }}
onSelect={id =>
dispatch({ type: 'set-field', field: 'payee', value: id })
......@@ -455,6 +456,7 @@ export default function ScheduleDetails() {
<AccountAutocomplete
includeClosedAccounts={false}
value={state.fields.account}
inputId="account-field"
inputProps={{ id: 'account-field', placeholder: '(none)' }}
onSelect={id =>
dispatch({ type: 'set-field', field: 'account', value: id })
......
import { useSelector } from 'react-redux';
import {
isDevelopmentEnvironment,
isPreviewEnvironment,
} from 'loot-design/src/util/environment';
const DEFAULT_FEATURE_FLAG_STATE = {
newAutocomplete: false,
newAutocomplete: isDevelopmentEnvironment() || isPreviewEnvironment(),
syncAccount: false,
goalTemplatesEnabled: false,
};
......
......@@ -40,7 +40,7 @@ const Autocomplete = React.forwardRef(
// Create a new option
if (selected.__isNew__) {
onCreateOption(selected);
onCreateOption(selected.value);
return;
}
......
......@@ -93,9 +93,9 @@ export default function PayeeAutocomplete({
inputValue={inputValue}
onInputChange={setInputValue}
onSelect={onSelect}
onCreateOption={async selected => {
onCreateOption={async selectedValue => {
const existingOption = allOptions.find(option =>
option.label.toLowerCase().includes(selected.label?.toLowerCase()),
option.label.toLowerCase().includes(selectedValue?.toLowerCase()),
);
// Prevent creating duplicates
......@@ -105,7 +105,7 @@ export default function PayeeAutocomplete({
}
// This is actually a new option, so create it
onSelect(await dispatch(createPayee(selected.value)));
onSelect(await dispatch(createPayee(selectedValue)));
}}
isCreatable={useCreatableComponent}
createOptionPosition="first"
......
---
category: Maintenance
authors: [MatissJanis]
---
Enable new autocomplete in dev/preview builds
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment