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

Remove the dependency loop hack for useStatementTableController #764

Closed
baurine opened this issue Sep 28, 2020 · 2 comments · Fixed by #771
Closed

Remove the dependency loop hack for useStatementTableController #764

baurine opened this issue Sep 28, 2020 · 2 comments · Fixed by #771
Assignees

Comments

@baurine
Copy link
Collaborator

baurine commented Sep 28, 2020

Related PR: #749 (comment)

Do so for useSlowQueryTableContoller as well.

Code:

  // Notice: statements, tableColumns, selectedFields make loop dependencies
  const tableColumns = useMemo(
    () => statementColumns(statements, showFullSQL),
    [statements, showFullSQL]
  )
  // make selectedFields as a string instead of an array to avoid infinite loop
  // I have verified that it will cause infinite loop if we return selectedFields as an array
  // so it is better to use the basic type (string, number...) instead of object as the dependency
  const selectedFields = useMemo(
    () => getSelectedFields(visibleColumnKeys, tableColumns).join(','),
    [visibleColumnKeys, tableColumns]
  )
@baurine baurine self-assigned this Sep 28, 2020
@unbyte
Copy link
Contributor

unbyte commented Oct 15, 2020

is there any progress on solving this issue? If not, I'd like to create a new PR for it.

@baurine
Copy link
Collaborator Author

baurine commented Oct 16, 2020

Not yet, please go ahead!

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

Successfully merging a pull request may close this issue.

2 participants