Skip to content

fix(web): events type #18946

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

Closed
wants to merge 3 commits into from
Closed

fix(web): events type #18946

wants to merge 3 commits into from

Conversation

thorkellmani
Copy link
Member

@thorkellmani thorkellmani commented May 6, 2025

What

  • Update eventList parameter type

Why

  • Old type causing build errors

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • Refactor
    • Improved the type definition for the event list, resulting in clearer and more direct type usage for event data in the event list component. No changes to visible functionality.

@thorkellmani thorkellmani requested review from a team as code owners May 6, 2025 09:58
@thorkellmani thorkellmani requested a review from sigruntg May 6, 2025 09:58
Copy link
Contributor

coderabbitai bot commented May 6, 2025

Walkthrough

The type definition for the eventList prop in the EventListProps interface was updated from a nested GraphQL query result type to a direct array of Event objects. The import statements were also simplified to reflect this change, with no alterations to component logic or rendering.

Changes

File Change Summary
apps/web/components/events/EventList.tsx Updated the eventList prop type in EventListProps from a nested query type to Array<Event>. Simplified imports to use Event and Image directly from the GraphQL schema.

Sequence Diagram(s)

sequenceDiagram
    participant ParentComponent
    participant EventList

    ParentComponent->>EventList: Passes eventList: Array<Event>
    EventList->>EventList: Uses eventList prop for rendering
Loading
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@thorkellmani thorkellmani removed request for a team and sigruntg May 6, 2025 09:59
Copy link

nx-cloud bot commented May 6, 2025

View your CI Pipeline Execution ↗ for commit 7d35543.

Command Status Duration Result
nx run-many --target=build --projects=web --par... ✅ Succeeded 10m 4s View ↗
nx run-many --projects web --target test --para... ✅ Succeeded 13s View ↗
nx run-many -t lint --output-style=static --pro... ✅ Succeeded 1s View ↗
nx run-many --target=codegen/frontend-client --... ✅ Succeeded 13s View ↗
nx run-many --target=codegen/backend-schema --a... ✅ Succeeded 5s View ↗
nx run-many --target=codegen/backend-client --a... ✅ Succeeded 29s View ↗
nx affected -t lint --base=origin/main --fix ✅ Succeeded 14s View ↗

☁️ Nx Cloud last updated this comment at 2025-05-06 10:23:08 UTC

@datadog-island-is
Copy link

Datadog Report

Branch report: fix/events-type
Commit report: faf6b15
Test service: web

✅ 0 Failed, 84 Passed, 0 Skipped, 9.93s Total Time

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
apps/web/components/events/EventList.tsx (2)

158-158: Consider improving type consistency

The code uses a type assertion as ImageSchema for the thumbnailImage property. This suggests that the thumbnailImage property in the Event interface might not be correctly typed.

Consider improving the Event interface to correctly type thumbnailImage as ImageSchema to avoid the need for type assertions:

- image={eventItem.thumbnailImage as ImageSchema}
+ image={eventItem.thumbnailImage}

This would require updating the Event interface to ensure thumbnailImage is properly typed as ImageSchema.


69-119: Consider using consistent variable naming

The component uses different variable names for the same concept: event in one loop and eventItem in others. Using consistent naming would improve readability.

Consider standardizing on either event or eventItem throughout the component for consistency:

- eventList.map((eventItem) => {
+ eventList.map((event) => {

Also applies to: 124-163, 168-186

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4966ff3 and 7d35543.

📒 Files selected for processing (1)
  • apps/web/components/events/EventList.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`apps/**/*`: "Confirm that the code adheres to the following: - NextJS best practices, including file structure, API routes, and static generation methods. - Efficient state manage...

apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
  • apps/web/components/events/EventList.tsx
🔇 Additional comments (2)
apps/web/components/events/EventList.tsx (2)

17-17: Improved type imports

The import statement has been simplified to directly import the Event type rather than using the nested GraphQL query result type. This makes the component's dependencies clearer and more direct, which is a good practice for maintainability.


29-29: Improved type definition

Updating from the nested GetEventsQuery['getEvents']['items'] to a straightforward Array<Event> simplifies the type definition and reduces coupling to the GraphQL query structure. This makes the component more flexible and easier to use with any source of Event data.

@thorkellmani thorkellmani deleted the fix/events-type branch May 9, 2025 10:51
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