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

fix: add filter in data board #336

Merged
merged 1 commit into from
Mar 1, 2024
Merged

fix: add filter in data board #336

merged 1 commit into from
Mar 1, 2024

Conversation

islxyqwe
Copy link
Member

@islxyqwe islxyqwe commented Mar 1, 2024

Fixed the issue that when click "DataView" in a filtered chart, the data in dialog will contains data that not filtered.

Copy link

vercel bot commented Mar 1, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
graphic-walker ✅ Ready (Inspect) Visit Preview Mar 1, 2024 6:01am

Copy link
Contributor

github-actions bot commented Mar 1, 2024

Risk Level 2 - /home/runner/work/graphic-walker/graphic-walker/packages/graphic-walker/src/components/dataBoard.tsx

The code changes seem to be well written and follow good practices. However, there are a few points that could be improved for better readability and maintainability:

  1. Use of magic strings: The code contains magic strings such as 'one of', 'expr'. It would be better to replace these magic strings with constants. This would make the code more maintainable and less error-prone.

  2. Complexity of useMemo hooks: The useMemo hooks are doing a lot of work and it might be hard to understand what's going on at first glance. Consider breaking down the logic inside useMemo into smaller, well-named functions to improve readability.

  3. Type assertion: There is a type assertion x.fid! in the code. It's generally better to avoid type assertions if possible, as they can potentially hide real issues. Consider adding proper checks or using optional chaining.

Example:

computedFileds.map((x) => ({
  expression: processExpression(x.expression!, allFields, config),
  key: x.fid ? x.fid : 'default',
}))
  1. Encoding filter rules: The function encodeFilterRule is being used to encode filter rules. Make sure that this function handles all possible edge cases and errors to avoid potential bugs.

🔮💡🔍


Powered by Code Review GPT

@ObservedObserver ObservedObserver merged commit a5574b5 into main Mar 1, 2024
6 checks passed
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 this pull request may close these issues.

2 participants