Skip to content
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

Field search in csv import column matching step is not good #5792

Open
FelixMalfait opened this issue Jun 9, 2024 · 1 comment
Open

Field search in csv import column matching step is not good #5792

FelixMalfait opened this issue Jun 9, 2024 · 1 comment
Labels
good first issue Good for newcomers scope: front Issues that are affecting the frontend side only type: bug Something isn't working

Comments

@FelixMalfait
Copy link
Member

When importing a CSV, the second step is to match columns with the file's header.
For each header item, we show a dropdown with our model fields which has a search bar.
But that search is very inefficient, often it doesn't even return exact matches.

@FelixMalfait FelixMalfait added type: bug Something isn't working good first issue Good for newcomers scope: front Issues that are affecting the frontend side only labels Jun 9, 2024
Copy link

greptile-apps bot commented Jun 9, 2024

Disclaimer: This comment was automatically generated with AI. It can give some useful hints as to where to look for, but sometimes it can also give very inaccurate answers so takes this with a pinch of salt :).

To improve the search functionality in the CSV import column matching step, update the handleSearchFilterChange function in MatchColumnSelect.tsx to perform a case-insensitive search and match substrings more effectively. Modify the function as follows:

const handleSearchFilterChange = useCallback(
  (text: string) => {
    const lowercasedFilter = text.toLowerCase();
    setOptions(
      initialOptions.filter((option) => 
        option.label.toLowerCase().includes(lowercasedFilter)
      ),
    );
  },
  [initialOptions],
);

This change ensures that the search is case-insensitive and matches any part of the option label.

References

/packages/twenty-front/src/modules/spreadsheet-import/components/MatchColumnSelect.tsx
/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep
/packages/twenty-front/src/modules/spreadsheet-import/steps/components/MatchColumnsStep/components

Ask Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers scope: front Issues that are affecting the frontend side only type: bug Something isn't working
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant