Change to using arrow functions (#1603)
* Change to using arrow functions Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add lint rule --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -7,7 +7,7 @@ import { filtersScopedState } from '../states/filtersScopedState';
|
||||
|
||||
import { useViewBarContext } from './useViewBarContext';
|
||||
|
||||
export function useFilterCurrentlyEdited() {
|
||||
export const useFilterCurrentlyEdited = () => {
|
||||
const { ViewBarRecoilScopeContext } = useViewBarContext();
|
||||
|
||||
const [filters] = useRecoilScopedState(
|
||||
@ -25,4 +25,4 @@ export function useFilterCurrentlyEdited() {
|
||||
(filter) => filter.key === filterDefinitionUsedInDropdown?.key,
|
||||
);
|
||||
}, [filterDefinitionUsedInDropdown, filters]);
|
||||
}
|
||||
};
|
||||
|
||||
@ -5,7 +5,7 @@ import { useRecoilScopedState } from '@/ui/utilities/recoil-scope/hooks/useRecoi
|
||||
import { ViewBarContext } from '../contexts/ViewBarContext';
|
||||
import { filtersScopedState } from '../states/filtersScopedState';
|
||||
|
||||
export function useRemoveFilter() {
|
||||
export const useRemoveFilter = () => {
|
||||
const { ViewBarRecoilScopeContext } = useContext(ViewBarContext);
|
||||
|
||||
const [, setFilters] = useRecoilScopedState(
|
||||
@ -13,11 +13,13 @@ export function useRemoveFilter() {
|
||||
ViewBarRecoilScopeContext,
|
||||
);
|
||||
|
||||
return function removeFilter(filterKey: string) {
|
||||
const removeFilter = (filterKey: string) => {
|
||||
setFilters((filters) => {
|
||||
return filters.filter((filter) => {
|
||||
return filter.key !== filterKey;
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return removeFilter;
|
||||
};
|
||||
|
||||
@ -7,7 +7,7 @@ import { Filter } from '../types/Filter';
|
||||
|
||||
import { useViewBarContext } from './useViewBarContext';
|
||||
|
||||
export function useUpsertFilter() {
|
||||
export const useUpsertFilter = () => {
|
||||
const { ViewBarRecoilScopeContext } = useViewBarContext();
|
||||
|
||||
const [, setFilters] = useRecoilScopedState(
|
||||
@ -15,7 +15,7 @@ export function useUpsertFilter() {
|
||||
ViewBarRecoilScopeContext,
|
||||
);
|
||||
|
||||
return function upsertFilter(filterToUpsert: Filter) {
|
||||
const upsertFilter = (filterToUpsert: Filter) => {
|
||||
setFilters((filters) => {
|
||||
return produce(filters, (filtersDraft) => {
|
||||
const index = filtersDraft.findIndex(
|
||||
@ -30,4 +30,6 @@ export function useUpsertFilter() {
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return upsertFilter;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user