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

HMR improvements for .ts files that include jsx #289

Open
7 tasks done
ic-768 opened this issue Feb 22, 2024 · 0 comments
Open
7 tasks done

HMR improvements for .ts files that include jsx #289

ic-768 opened this issue Feb 22, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ic-768
Copy link

ic-768 commented Feb 22, 2024

Describe the bug

I have a bunch of hooks that handle logic behind rendering tables.

For example:

export const useAnimalTable = ({
  onRowClick,,
}: UseAnimalTableArgs) => {
  const { t } = useTranslation();
  const { isRegionalAdmin } = useCurrentUser();
  const queryClient = useQueryClient();

  const [animalFilter, setAnimalFilter] = useState<string>();


  const columns: ColumnDef<AnimalTableData, any>[] = [
    {
      accessorKey: "animal",
      enableSorting: true,
      header: (c) => (
        <SortableHeader label={t("animal")} column={c}>
          <Filter
            inputName="animal"
            value={animalFilter}
            setValue={onChangeAnimalFilter}
            ref={animalRef}
          />
        </SortableHeader>
      ),
    },
    //... more stuff down here}

And this returns the columns along with a bunch of functions also declared in the hook.

I use a .tsx file extension for this file to get proper syntax highlighting but also because using a .ts extension causes all sorts of errors to pop out because the components and the jsx aren't recognised. But this causes the hmr invalidate warning for consistent components exports.

Reproduction

#288

Steps to reproduce

No response

System Info

linux

Used Package Manager

npm

Logs

No response

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants