-
Notifications
You must be signed in to change notification settings - Fork 20
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
Implement new simple text filter #1526
Conversation
@@ -0,0 +1,57 @@ | |||
import { useLazyQuery } from '@apollo/client'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Straight clone of the previous TextFilter file
@@ -30,6 +30,11 @@ export const Input = ({ | |||
const [value, setValue] = useState<string | undefined>(initialValue ?? ''); | |||
const debouncedValue = useDebounce<string | undefined>(value, 800); // debounce request for 800ms | |||
|
|||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this change, the new TextFilter does not empty its value when clicking on 'Empty FIlters'. Another solution would be we have an uncontrolled Input component that does not track state like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should still be a controlled input, just not have its own state, e.g. use the filter to hold the state the way the rest of the filter components do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things:
- We should make the filter component stateless the way it is for other filters, e.g. it just stores its state in the filter itself.
- We should make the default
TEXT
notDROP_DOWN_TEXT
forID
andString
types.
@@ -30,6 +30,11 @@ export const Input = ({ | |||
const [value, setValue] = useState<string | undefined>(initialValue ?? ''); | |||
const debouncedValue = useDebounce<string | undefined>(value, 800); // debounce request for 800ms | |||
|
|||
useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should still be a controlled input, just not have its own state, e.g. use the filter to hold the state the way the rest of the filter components do.
case 'Number': | ||
return AdminUIFilterType.NUMERIC; | ||
case 'String': | ||
return AdminUIFilterType.TEXT; | ||
return AdminUIFilterType.DROP_DOWN_TEXT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default should be TEXT
for both ID
and String
I reckon.
Adding a new filter type for the admin-ui-components filter bar. This is a simple text input, it has no auto complete, it just fetches with the value you have typed in. You can get an exact match if your filter value is correct. This is to help with usability issues on large list views.
There is a relatively invasive UI change here. The entity-list currently replaces the content area with a big loading image while a new filter is being applied to the query. This mens that your typing location and focus is being thrown away. It's fairly unnecessary, as the table area has its own spinner, so I'm just removing the use of the big loader image.
There is technically a breaking change in here, as the meaning of AdminUIFilterType.TEXT has changed with no migration path
I've noticed that there are duplicate enum definitions for AdminUIFilterType in the core and admin-ui-components packages. There's no dependency between these packages either way right now. I assume the solution will be to create a shared package for this type. I have no idea how many other types might be in this duplicated state