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

minor fixes to react render #241

Merged
merged 2 commits into from
Nov 24, 2024
Merged

minor fixes to react render #241

merged 2 commits into from
Nov 24, 2024

Conversation

dinmukhamedm
Copy link
Member

@dinmukhamedm dinmukhamedm commented Nov 24, 2024

  1. Update route using useEffect because on some loads there was a warning about setting state while rendering
  2. Force type cast instead of convert so that we don't use Mono like it is not intended. This is hacky, but better than silently stringifying internal react.

Important

Fixes rendering warning in EvaluationsGroupsBar and enforces type casting in MonoWithCopy.

  • Behavior:
    • Use useEffect in EvaluationsGroupsBar to update route after rendering, preventing state-setting warnings.
    • Force type cast children to string in MonoWithCopy to ensure correct usage, avoiding silent stringification.
  • Files:
    • evaluations-groups-bar.tsx: Wraps router logic in useEffect.
    • mono-with-copy.tsx: Adds type casting for children prop.

This description was created by Ellipsis for 670775b. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Reviewed everything up to 3dcaa91 in 34 seconds

More details
  • Looked at 42 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_dR0eA0q1IwBf9Cwy


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

if (groups && groups.length > 0 && !searchParams.get('groupId')) {
router.replace(`/project/${projectId}/evaluations?groupId=${groups[0].groupId}`);
}
}, [groups, searchParams, router, projectId]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Including 'searchParams' in the dependency array can cause unnecessary re-renders. Consider extracting the specific parameter needed, like 'searchParams.get("groupId")', and include that instead.

Suggested change
}, [groups, searchParams, router, projectId]);
}, [groups, searchParams.get("groupId"), router, projectId]);

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 670775b in 20 seconds

More details
  • Looked at 37 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/components/evaluations/evaluations-groups-bar.tsx:27
  • Draft comment:
    Avoid including 'router' in the dependency array of useEffect as it can cause unnecessary re-renders. Consider removing it.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_1SIrGZqaESzI9FEg


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@dinmukhamedm dinmukhamedm merged commit 29efbda into dev Nov 24, 2024
1 check passed
@dinmukhamedm dinmukhamedm deleted the fix/render branch November 24, 2024 19:23
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.

1 participant