-
Notifications
You must be signed in to change notification settings - Fork 18
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
All 1.3 feedback change #247
Conversation
…e lost and earn], fill in the blanks and jumble the words mechanism
Issueid #232843 fix: Audio sync issue for low network - Showcase [liv…
Caution Review failedThe pull request is closed. Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 eslint
src/components/Assesment/Assesment.jsxOops! Something went wrong! :( ESLint: 7.32.0 ESLint couldn't find the config "react-app" to extend from. Please check that the name of the config is correct. The config "react-app" was referenced from the config file in "/package.json". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. WalkthroughThe pull request introduces a custom Changes
Possibly related PRs
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this 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 (5)
src/components/Practice/Mechanics4.jsx (2)
122-122
: Potential redundancy in constructing the Audio object
Since each variable (e.g.,removeSoundAudio
) is already an audio object returned byusePreloadAudio
, creating a newAudio(...)
with that same reference could lead to re-downloading or re-initializing audio. You can simplify and directly callremoveSoundAudio.play()
without using thenew Audio(...)
constructor.- let audio = new Audio(isSelected ? removeSoundAudio : addSoundAudio); - audio.play(); + (isSelected ? removeSoundAudio : addSoundAudio).play();
142-143
: Avoid repeated new Audio instantiation
As with line 122, you can use the preloaded audio references directly instead of passing them tonew Audio(...)
.-let audio = new Audio( - [...selectedWords, word]?.join(" ") === parentWords - ? correctSoundAudio - : wrongSoundAudio -); -audio.play(); +[...selectedWords, word]?.join(" ") === parentWords + ? correctSoundAudio.play() + : wrongSoundAudio.play();src/components/Practice/Mechanics3.jsx (2)
92-92
: Redundant usage ofnew Audio
with a preloaded reference
Similar to the pattern inMechanics4
, you can directly play the preloaded audio reference:- let audio = new Audio(isSoundCorrect ? correctSoundAudio : wrongSoundAudio); - audio.play(); + (isSoundCorrect ? correctSoundAudio : wrongSoundAudio).play();
104-104
: Directly call.play()
on the preloaded audio
As above, skip re-instantiating the same audio content vianew Audio(...)
and call.play()
directly.- let audio = new Audio(removeSoundAudio); - audio.play(); + removeSoundAudio.play();src/utils/VoiceAnalyser.js (1)
634-634
: Refactor to avoid double initialization
You might streamline the audio logic by invoking.play()
directly onisLiveLost ? livesCutAudio : livesAddAudio
rather than wrapping the reference again withnew Audio(...)
.- const audio = new Audio(isLiveLost ? livesCutAudio : livesAddAudio); - audio.play(); + (isLiveLost ? livesCutAudio : livesAddAudio).play();
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/components/Practice/Mechanics3.jsx
(4 hunks)src/components/Practice/Mechanics4.jsx
(4 hunks)src/utils/VoiceAnalyser.js
(3 hunks)
🔇 Additional comments (6)
src/components/Practice/Mechanics4.jsx (2)
16-16
: Imported custom hook looks good
The usage of theusePreloadAudio
hook import is consistent with the changes below. No issues found.
55-58
: Good use ofusePreloadAudio
for performance
Preloading audio files can help reduce latency when playing sounds at runtime. This is a neat improvement. Consider verifying that the audio files are small enough not to adversely impact page load performance.src/components/Practice/Mechanics3.jsx (2)
21-21
: New hook import for audio preloading
This import statement is consistent with the project’s new pattern for better audio handling. No objections.
68-70
: Preloaded audio references introduced
Allocating references for correct, wrong, and remove sounds via the custom hook is a solid approach to reduce runtime audio load delays.src/utils/VoiceAnalyser.js (2)
36-36
: Custom hook import is consistent
Prefetching audio for lives management aligns with the new pattern used inMechanics3
andMechanics4
.
81-82
: Excellent approach to preload synergy
PreloadinglivesAdd
andlivesCut
is a good optimization to ensure quick feedback on life changes.
…29 Triggered When Not Required
Issueid #232821 fix: Unexpected API Call: /pointer/getPoints/43477152…
There was a problem hiding this 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 (3)
src/components/AssesmentEnd/AssesmentEnd.jsx (1)
51-56
: Consider adding error handling and reusability for pointer fetching.You're conditionally fetching pointer details only if not in iframe, which is good for avoiding unnecessary requests. However, there's no try/catch block in this snippet, and no fallback if the environment variable is missing or incorrectly set. Also, this pointer-fetch logic repeats across multiple files. Extracting it into a shared helper could improve maintainability.
Here’s an example snippet adding basic error handling within these lines:
51 if (process.env.REACT_APP_IS_APP_IFRAME !== "true") { 52 + try { 53 const getPointersDetails = await axios.get( 54 `${process.env.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.GET_POINTER}/${virtualId}/${sessionId}?language=${lang}` 55 ); 56 setPoints(getPointersDetails?.data?.result?.totalLanguagePoints || 0); + } catch (error) { + console.error('Error fetching pointer details:', error); + } 57 }src/components/Assesment/Assesment.jsx (1)
601-606
: Add error handling for pointer fetching and consider a helper function.Similar to
AssesmentEnd.jsx
, you might wrap this block in a try/catch to gracefully handle network failures. If you plan to reuse this pointer-fetch logic across files, consider centralizing it in a shared utility.601 if (process.env.REACT_APP_IS_APP_IFRAME !== "true") { 602 + try { 603 const getPointersDetails = await axios.get( 604 `${process.env.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.GET_POINTER}/${usernameDetails?.data?.result?.virtualID}/${session_id}?language=${lang}` 605 ); 606 setPoints(getPointersDetails?.data?.result?.totalLanguagePoints || 0); + } catch (error) { + console.error('Error fetching pointer details:', error); + } 607 }src/views/Practice/Practice.jsx (1)
455-462
: Refine pointer fetching with error handling, and centralize repeated logic.The environment-based check is a clean way to prevent calls within an iframe. However, ensure you handle request failures. This block appears across multiple files; consider moving it into a reusable utility to keep your code DRY.
455 if (process.env.REACT_APP_IS_APP_IFRAME !== "true") { 456 + try { 457 const getPointersDetails = await axios.get( 458 `${process.env.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.GET_POINTER}/${virtualId}/${sessionId}?language=${lang}` 459 ); 460 // TODO: Just Opss icon - we are trying to fetch the score for you 461 setPoints(getPointersDetails?.data?.result?.totalLanguagePoints || 0); + } catch (error) { + console.error('Error fetching pointer details:', error); + } 462 }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/components/Assesment/Assesment.jsx
(2 hunks)src/components/AssesmentEnd/AssesmentEnd.jsx
(1 hunks)src/views/Practice/Practice.jsx
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: deploy
🔇 Additional comments (1)
src/components/Assesment/Assesment.jsx (1)
639-639
: Include error handling or a fallback for missingvirtualId
.When
virtualId
is undefined, this check won't fetch pointer details. Ensure the rest of the code can gracefully handle that scenario. Also consider a try/catch for the subsequent operations.
Quality Gate passedIssues Measures |
Summary by CodeRabbit
Release Notes
New Features
Performance Improvements
Bug Fixes
Technical Updates
These updates aim to provide a smoother and more responsive user experience with improved audio interactions.