[ESLint rule]: recoil value and setter should be named after their at… (#1402)
* Override unwanted changes Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br> Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com> * Fix the tests Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br> Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com> --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Toledodev <rafael.toledo@engenharia.ufjf.br> Co-authored-by: Rafael Toledo <87545086+Toledodev@users.noreply.github.com> Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
@ -14,12 +14,11 @@ export type OwnProps = {
|
||||
};
|
||||
|
||||
export function CompanyPicker({ companyId, onSubmit, onCancel }: OwnProps) {
|
||||
const [searchFilter, setSearchFilter] = useRecoilScopedState(
|
||||
relationPickerSearchFilterScopedState,
|
||||
);
|
||||
const [relationPickerSearchFilter, setRelationPickerSearchFilter] =
|
||||
useRecoilScopedState(relationPickerSearchFilterScopedState);
|
||||
|
||||
const companies = useFilteredSearchCompanyQuery({
|
||||
searchFilter,
|
||||
searchFilter: relationPickerSearchFilter,
|
||||
selectedIds: companyId ? [companyId] : [],
|
||||
});
|
||||
|
||||
@ -30,8 +29,8 @@ export function CompanyPicker({ companyId, onSubmit, onCancel }: OwnProps) {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
setSearchFilter('');
|
||||
}, [setSearchFilter]);
|
||||
setRelationPickerSearchFilter('');
|
||||
}, [setRelationPickerSearchFilter]);
|
||||
|
||||
return (
|
||||
<SingleEntitySelect
|
||||
|
||||
@ -29,20 +29,20 @@ export function CompanyPickerCell({
|
||||
createModeEnabled,
|
||||
width,
|
||||
}: OwnProps) {
|
||||
const [isCreating, setIsCreating] = useRecoilScopedState(
|
||||
const [isCreateMode, setIsCreateMode] = useRecoilScopedState(
|
||||
isCreateModeScopedState,
|
||||
);
|
||||
|
||||
const [insertCompany] = useInsertOneCompanyMutation();
|
||||
|
||||
const [searchFilter] = useRecoilScopedState(
|
||||
const [relationPickerSearchFilter] = useRecoilScopedState(
|
||||
relationPickerSearchFilterScopedState,
|
||||
);
|
||||
|
||||
const setHotkeyScope = useSetHotkeyScope();
|
||||
|
||||
const companies = useFilteredSearchCompanyQuery({
|
||||
searchFilter,
|
||||
searchFilter: relationPickerSearchFilter,
|
||||
selectedIds: [companyId ?? ''],
|
||||
});
|
||||
|
||||
@ -53,7 +53,7 @@ export function CompanyPickerCell({
|
||||
}
|
||||
|
||||
function handleStartCreation() {
|
||||
setIsCreating(true);
|
||||
setIsCreateMode(true);
|
||||
setHotkeyScope(TableHotkeyScope.CellDoubleTextInput);
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ export function CompanyPickerCell({
|
||||
entityType: Entity.Company,
|
||||
domainName: companyCreated.domainName,
|
||||
});
|
||||
setIsCreating(false);
|
||||
setIsCreateMode(false);
|
||||
}
|
||||
const noCompany: CompanyPickerSelectedCompany = {
|
||||
entityType: Entity.Company,
|
||||
@ -85,9 +85,9 @@ export function CompanyPickerCell({
|
||||
domainName: '',
|
||||
avatarUrl: '',
|
||||
};
|
||||
return isCreating ? (
|
||||
return isCreateMode ? (
|
||||
<DoubleTextCellEdit
|
||||
firstValue={searchFilter}
|
||||
firstValue={relationPickerSearchFilter}
|
||||
secondValue={''}
|
||||
firstValuePlaceholder={'Name'}
|
||||
secondValuePlaceholder={'Url'}
|
||||
|
||||
@ -12,11 +12,9 @@ import { turnFilterIntoWhereClause } from '@/ui/filter-n-sort/utils/turnFilterIn
|
||||
import { useRecoilScopedState } from '@/ui/utilities/recoil-scope/hooks/useRecoilScopedState';
|
||||
import { useRecoilScopedValue } from '@/ui/utilities/recoil-scope/hooks/useRecoilScopedValue';
|
||||
import {
|
||||
Pipeline,
|
||||
PipelineProgressableType,
|
||||
PipelineProgressOrderByWithRelationInput as PipelineProgresses_Order_By,
|
||||
} from '~/generated/graphql';
|
||||
import {
|
||||
Pipeline,
|
||||
useGetCompaniesQuery,
|
||||
useGetPipelineProgressQuery,
|
||||
useGetPipelinesQuery,
|
||||
|
||||
@ -53,10 +53,12 @@ export function NewCompanyProgressButton() {
|
||||
setIsCreatingCard(false);
|
||||
}
|
||||
|
||||
const [searchFilter] = useRecoilScopedState(
|
||||
const [relationPickerSearchFilter] = useRecoilScopedState(
|
||||
relationPickerSearchFilterScopedState,
|
||||
);
|
||||
const companies = useFilteredSearchCompanyQuery({ searchFilter });
|
||||
const companies = useFilteredSearchCompanyQuery({
|
||||
searchFilter: relationPickerSearchFilter,
|
||||
});
|
||||
|
||||
return (
|
||||
<RecoilScope>
|
||||
|
||||
@ -17,12 +17,12 @@ export function useCreateCompanyProgress() {
|
||||
],
|
||||
});
|
||||
|
||||
const [pipeline] = useRecoilState(currentPipelineState);
|
||||
const [currentPipeline] = useRecoilState(currentPipelineState);
|
||||
|
||||
return useRecoilCallback(
|
||||
({ set }) =>
|
||||
async (companyId: string, pipelineStageId: string) => {
|
||||
if (!pipeline?.id) {
|
||||
if (!currentPipeline?.id) {
|
||||
throw new Error('Pipeline not found');
|
||||
}
|
||||
|
||||
@ -37,11 +37,11 @@ export function useCreateCompanyProgress() {
|
||||
variables: {
|
||||
uuid: newUuid,
|
||||
pipelineStageId: pipelineStageId,
|
||||
pipelineId: pipeline?.id ?? '',
|
||||
pipelineId: currentPipeline?.id ?? '',
|
||||
companyId: companyId,
|
||||
},
|
||||
});
|
||||
},
|
||||
[createOneCompanyPipelineProgress, pipeline],
|
||||
[createOneCompanyPipelineProgress, currentPipeline],
|
||||
);
|
||||
}
|
||||
|
||||
@ -21,11 +21,11 @@ import { companiesFilters } from '~/pages/companies/companies-filters';
|
||||
import { availableSorts } from '~/pages/companies/companies-sorts';
|
||||
|
||||
export function CompanyTable() {
|
||||
const orderBy = useRecoilScopedValue(
|
||||
const sortsOrderBy = useRecoilScopedValue(
|
||||
sortsOrderByScopedSelector,
|
||||
TableRecoilScopeContext,
|
||||
);
|
||||
const whereFilters = useRecoilScopedValue(
|
||||
const filtersWhere = useRecoilScopedValue(
|
||||
filtersWhereScopedSelector,
|
||||
TableRecoilScopeContext,
|
||||
);
|
||||
@ -55,8 +55,10 @@ export function CompanyTable() {
|
||||
getRequestResultKey="companies"
|
||||
useGetRequest={useGetCompaniesQuery}
|
||||
getRequestOptimisticEffect={getCompaniesOptimisticEffect}
|
||||
orderBy={orderBy.length ? orderBy : [{ createdAt: SortOrder.Desc }]}
|
||||
whereFilters={whereFilters}
|
||||
orderBy={
|
||||
sortsOrderBy.length ? sortsOrderBy : [{ createdAt: SortOrder.Desc }]
|
||||
}
|
||||
whereFilters={filtersWhere}
|
||||
filterDefinitionArray={companiesFilters}
|
||||
setContextMenuEntries={setContextMenuEntries}
|
||||
setActionBarEntries={setActionBarEntries}
|
||||
|
||||
@ -10,7 +10,7 @@ import { companiesAvailableColumnDefinitions } from '../../constants/companiesAv
|
||||
import { mockedCompaniesData } from './companies-mock-data';
|
||||
|
||||
export function CompanyTableMockData() {
|
||||
const [, setColumns] = useRecoilScopedState(
|
||||
const [, setTableColumns] = useRecoilScopedState(
|
||||
tableColumnsScopedState,
|
||||
TableRecoilScopeContext,
|
||||
);
|
||||
@ -19,8 +19,8 @@ export function CompanyTableMockData() {
|
||||
useEffect(() => {
|
||||
setEntityTableData(mockedCompaniesData, []);
|
||||
|
||||
setColumns(companiesAvailableColumnDefinitions);
|
||||
}, [setColumns, setEntityTableData]);
|
||||
setTableColumns(companiesAvailableColumnDefinitions);
|
||||
}, [setEntityTableData, setTableColumns]);
|
||||
|
||||
return <></>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user