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

Error RangeError: Maximum call stack size exceeded #4090

Closed
2 tasks done
amantiwari1 opened this issue Jul 3, 2022 · 10 comments
Closed
2 tasks done

Error RangeError: Maximum call stack size exceeded #4090

amantiwari1 opened this issue Jul 3, 2022 · 10 comments

Comments

@amantiwari1
Copy link

amantiwari1 commented Jul 3, 2022

Describe the bug

After working migrated v7 to v8

I tested tsc and suddenly error comes

$ D:\work\****\****\node_modules\.bin\tsc
D:\work\****\****\node_modules\typescript\lib\tsc.js:96888
                throw e;
                ^

RangeError: Maximum call stack size exceeded
    at isRelatedTo (D:\work\****\****\node_modules\typescript\lib\tsc.js:53941:33)    at someTypeRelatedToType (D:\work\****\****\node_modules\typescript\lib\tsc.js:54272:35)
    at unionOrIntersectionRelatedTo (D:\work\****\****\node_modules\typescript\lib\tsc.js:54208:24)
    at structuredTypeRelatedTo (D:\work\****\****\node_modules\typescript\lib\tsc.js:54509:34)
    at recursiveTypeRelatedTo (D:\work\****\****\node_modules\typescript\lib\tsc.js:54431:30)
    at isRelatedTo (D:\work\****\****\node_modules\typescript\lib\tsc.js:54019:25)    at typeRelatedToEachType (D:\work\****\****\node_modules\typescript\lib\tsc.js:54257:35)
    at unionOrIntersectionRelatedTo (D:\work\****\****\node_modules\typescript\lib\tsc.js:54197:28)
    at structuredTypeRelatedTo (D:\work\****\****\node_modules\typescript\lib\tsc.js:54509:34)
    at recursiveTypeRelatedTo (D:\work\****\****\node_modules\typescript\lib\tsc.js:54431:30)
error Command failed with exit code 1.

I confirmed it is related to react table
because I commented on it and it works

But unable to figure to fix it

here's code

  const tableReact = useReactTable({
    data,
    columns,
    getCoreRowModel: getCoreRowModel(),
    getSortedRowModel: getSortedRowModel(),
    state: {
      sorting,
    },
    onSortingChange: setSorting,
  })

Your minimal, reproducible example

no terminal support :/ on this platform

Steps to reproduce

  1. migrate v7 to v8
  2. all table is working well
  3. type check - npx tsc or yarn tsc
  4. RangeError: Maximum call stack size exceeded

Expected behavior

no error :)

How often does this bug happen?

Only once

Screenshots or Videos

No response

Platform

OS - Windows 11
Edge - 103.0.1264.44

react-table version

8.1.3

TypeScript version

4.4

Additional context

No response

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
@KevinVandy
Copy link
Member

A code sandbox reproducing this is probably the only way this could be debugged. Though look into making sure your data is memoized or stable

@amantiwari1
Copy link
Author

amantiwari1 commented Jul 3, 2022

I understand! finally, I made it - https://github.com/amantiwari1/react-table-bugs

code sandbox - https://codesandbox.io/s/headless-violet-yskpzy

there is no terminal in the code sandbox so

for debugging, you might clone https://github.com/amantiwari1/react-table-bugs

  1. yarn
  2. yarn tsc

error come

@amantiwari1
Copy link
Author

@KevinVandy any update?

@PerryRylance
Copy link

@amantiwari1 I'm encountering the same issue today and working through solving it. Have you tried starting with the example at https://react-table-v7.tanstack.com/docs/quick-start and building on that?

@amantiwari1
Copy link
Author

@PerryRylance version 7 works fine
I am using react table v8 actually

@amantiwari1
Copy link
Author

@tannerlinsley do you have any idea how to fix this bug?

@RafaelGB
Copy link

RafaelGB commented Jul 7, 2022

Happens to me with V8 too

const tableOptions: TableOptions<RowDataType> = {
    data,
    columns,
    defaultColumn,
    getCoreRowModel: getCoreRowModel(),
  };
const table: any = useReactTable(tableOptions);

Where RowDataType

export type RowDataType = {
    id: number,
    __note__: NoteInfo,
    [key: string]: Literal | NoteInfo
}

And columns an array of TableColumn

export interface BaseColumn {
    csvCandidate?: boolean;
    accessor: string;
    label: string;
    key: string;
    position?: number;
    isMetadata?: boolean;
    skipPersist?: boolean;
    isDragDisabled?: boolean;
    config: ConfigColumn;
}
export interface TableColumn extends BaseColumn {
    isSortedDesc?: boolean;
    isSorted?: boolean;
    id: string;
    minWidth?: number;
    width?: number;
    dataType: string;
    options?: RowSelectOption[];
    Cell?: any;
    getHeaderProps?: any;
    getResizerProps?: any;
}

I suppose that the problem comes from the type of Object that is declared, if I find any other clue I will post here.

BTW thanks for this fantastic library. I am trying to migrate to v8 my repo https://github.com/RafaelGB/obsidian-db-folder

@tannerlinsley
Copy link
Collaborator

The codesandbox supplied here is not a reproducible example. It appears to just be a dump of a repo into code sandbox. In order for me to help debug this, I need something I can open and run right away and see an error.

Also, does the code work at runtime, but not during typechecking? I don't understand why you are seeing this error when you run tsc.

If it's not working at runtime, my best guess here is that you are not memoizing something like data or columns. Outside of that I'll need a better codesandbox to debug. Do not just dump your code into a sandobox repo. It's much better if you take one of the existing codesandbox examples from the repo and make only the required changes to make it break similar to your own.

Please reopen a new issue with the codesandbox repro and I'll take a deeper look. Thanks!

@RafaelGB
Copy link

RafaelGB commented Jul 8, 2022

I can confirm that with 8.2.1 the problem was fixed. Thanks!

@amantiwari1
Copy link
Author

same here, it is working great btw

thank you for making amazing this library 🚀🚀🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants