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

Test/unify fetch speaker logic #670

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

anyulled
Copy link
Member

No description provided.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @anyulled, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on unifying the logic for fetching speaker data across different components and sections of the application. The primary goal is to consolidate the useFetchSpeakers hook into a single location (src/views/Speakers) and ensure that all components that require speaker data utilize this unified hook. This involves modifying components such as SpeakerSwiper, SpeakerDetailContainer2023, Speakers2023, SpeakerDetailContainer2024, and MeetingDetailContainer to use the centralized hook and pass the appropriate sessionizeUrl from the conference data.

Highlights

  • Hook Consolidation: The useFetchSpeakers hook has been moved to src/views/Speakers to provide a single source of truth for fetching speaker data.
  • Component Updates: Multiple components have been updated to use the consolidated useFetchSpeakers hook, ensuring consistency in data fetching.
  • Data Source Configuration: The sessionizeUrl from the conference data (2023.json, 2024.json, 2025.json) is now passed to the useFetchSpeakers hook to specify the data source.
  • Test Removal: The pull request removes the now-obsolete test file src/2024/Speakers/UseFetchSpeakers.test.tsx.

Changelog

Click here to see the changelog
  • src/2023/Home/components/SpeakersCarousel/SpeakerSwiper.tsx
    • Updated import path for useFetchSpeakers from a local directory to the centralized location in src/views/Speakers.
    • Modified the useFetchSpeakers hook call to pass the sessionizeUrl from conferenceData.
  • src/2023/SpeakerDetail/SpeakerDetailContainer2023.tsx
    • Updated import path for useFetchSpeakers from a local directory to the centralized location in src/views/Speakers.
    • Modified the useFetchSpeakers hook call to pass the sessionizeUrl from conferenceData and the speaker id.
  • src/2023/Speakers/Speakers2023.tsx
    • Updated import path for useFetchSpeakers from a local directory to the centralized location in src/views/Speakers.
    • Modified the useFetchSpeakers hook call to pass the sessionizeUrl from webData.
    • Removed extra space at the end of slash lines.
  • src/2024/SpeakerDetail/SpeakerDetailContainer2024.tsx
    • Updated import path for useFetchSpeakers from a local directory to the centralized location in src/views/Speakers.
    • Modified the useFetchSpeakers hook call to pass the sessionizeUrl from conferenceData and the speaker id.
  • src/2024/Speakers/Speakers2024.tsx
    • Updated import path for useFetchSpeakers from a local directory to the centralized location in src/views/Speakers.
    • Modified the useFetchSpeakers hook call to pass the sessionizeUrl from webData.
    • Removed extra space at the end of slash lines.
  • src/2024/Speakers/UseFetchSpeakers.test.tsx
    • The UseFetchSpeakers.test.tsx file was removed.
  • src/2024/SpeakersCarousel/SpeakerSwiper.tsx
    • Updated import path for useFetchSpeakers from a local directory to the centralized location in src/views/Speakers.
    • Modified the useFetchSpeakers hook call to pass the sessionizeUrl from conferenceData.
  • src/2024/TalkDetail/MeetingDetailContainer.tsx
    • Updated import path for useFetchSpeakers from a local directory to the centralized location in src/views/Speakers.
    • Modified the useFetchSpeakers hook call to pass the sessionizeUrl from conferenceData.
  • src/App.test.tsx
    • Added mockedAxios and payload for testing.
  • src/data/2023.json
    • Added sessionizeUrl.
  • src/data/2024.json
    • Added sessionizeUrl.
  • src/data/2025.json
    • Added sessionizeUrl.
  • src/services/speakerAdapter.test.ts
    • Added test file for speakerAdapter.
  • src/views/Speakers/Speakers.tsx
    • Updated import path for useFetchSpeakers from a local directory to the centralized location in src/views/Speakers.
    • Modified the useFetchSpeakers hook call to pass the sessionizeUrl from webData.
    • Removed extra space at the end of slash lines.
  • src/views/Speakers/UseFetchSpeakers.test.tsx
    • Updated test file for useFetchSpeakers.
  • src/views/Speakers/UseFetchSpeakers.ts
    • The useFetchSpeakers hook is now the single source of truth for fetching speaker data.
    • The hook now accepts a url parameter to specify the data source.
    • The hook now includes Victor Rentea as a speaker.
  • src/views/Talks/useFetchTalks.test.tsx
    • Removed describe block for Fetch Live session talks.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Did you know?

The term "hook" in React was inspired by the concept of "hooks" in functional programming, which allow you to "hook into" state and lifecycle features from function components.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request makes significant improvements to the codebase by unifying the speaker fetching logic. The changes are well-structured and address the issue of inconsistent data fetching across different components. However, it's crucial to ensure that all components that previously used the old useFetchSpeakers hook are updated to use the new hook and that the removal of the old hook doesn't break any existing functionality. Also, the slash inconsistencies should be addressed.

Summary of Findings

  • Unifying speaker fetch logic: The pull request aims to unify the speaker fetch logic by moving the useFetchSpeakers hook to a common directory (src/views/Speakers) and passing the sessionizeUrl from the conference data JSON files. This ensures consistency across different components and years.
  • Removal of UseFetchSpeakers.ts and UseFetchSpeakers.test.tsx: The original UseFetchSpeakers.ts and UseFetchSpeakers.test.tsx files in the src/2024/Speakers/ directory have been removed as part of the unification process. This might impact existing tests or require adjustments in components relying on the old hook location.
  • Slash consistency: There are some inconsistencies in the number of slashes used in the StyledSlash components across different files. While minor, maintaining consistency improves code aesthetics.

Merge Readiness

The pull request is almost ready for merging. Before merging, it's important to verify that all components that previously used the old useFetchSpeakers hook are updated to use the new hook and that the removal of the old hook doesn't break any existing functionality. Additionally, the slash inconsistencies should be addressed. I am unable to approve this pull request, and users should have others review and approve this code before merging.

Copy link

netlify bot commented Mar 17, 2025

Deploy Preview for dev-bcn ready!

Name Link
🔨 Latest commit 6275912
🔍 Latest deploy log https://app.netlify.com/sites/dev-bcn/deploys/67daa2d75c13d40008bcefe6
😎 Deploy Preview https://deploy-preview-670--dev-bcn.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@anyulled anyulled force-pushed the test/unify-fetch-speaker-logic branch 2 times, most recently from f40e669 to 611b441 Compare March 18, 2025 14:19
@anyulled
Copy link
Member Author

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request unifies the logic for fetching speakers and updating document titles across the application. It introduces a useDocumentTitleUpdater hook to manage document titles and centralizes speaker fetching logic. Overall, the changes improve code maintainability and consistency.

Summary of Findings

  • Inconsistent Title Separator: The title separator varies across the application. It's recommended to use a consistent separator (e.g., '—') for better UI consistency.
  • Missing Error Handling: While the useSentryErrorReport hook is used, it's important to ensure that all potential errors are properly caught and reported to Sentry to maintain application stability.
  • Potential Performance Bottleneck: Shuffling the speaker array on every render in SpeakerSwiper might lead to performance issues. Consider caching the shuffled array or using a more efficient shuffling mechanism.

Merge Readiness

The pull request is almost ready for merging. However, there are a few issues that need to be addressed before merging. Specifically, the title separator inconsistency and potential performance bottleneck in SpeakerSwiper should be resolved. Additionally, ensure that all potential errors are properly caught and reported to Sentry. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging. At a minimum, the high severity comments should be addressed before merging.

anyulled and others added 9 commits March 18, 2025 22:11
…umbers from a cryptographically secure source

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…umbers from a cryptographically secure source

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@anyulled anyulled force-pushed the test/unify-fetch-speaker-logic branch from 62e7c80 to 6275912 Compare March 19, 2025 10:56
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
35.9% Coverage on New Code (required ≥ 75%)
36.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

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