-
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.1 dev #256
All 1.3.1 dev #256
Conversation
Issueid #232285 fix: Jumble the word - Invalid content displays.PFA
… to updatelearnerprofile api
issueid #232952 feat: passing virtual id to telemetry and mechanic id…
All 1.3 feedback change
issueid #0000 updated telemetry npm package
All 1.3 feedback change
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/App.jsOops! 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 changes to multiple files focusing on telemetry service integration and state management. The primary modifications include switching the telemetry SDK from Changes
Sequence DiagramsequenceDiagram
participant App
participant TelemetryService
participant LocalStorage
participant Practice
App->>LocalStorage: Retrieve/Generate visitorId
App->>TelemetryService: Initialize(visitorId)
Practice->>LocalStorage: Store mechanism ID
Practice->>Mechanics: Pass next button state
Mechanics->>VoiceAnalyser: Manage interaction state
Possibly related PRs
Finishing Touches
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
|
Quality Gate passedIssues Measures |
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: 2
🧹 Nitpick comments (3)
src/App.js (2)
58-60
: Remove commented out code.Instead of keeping commented code, it should be removed as it can lead to confusion and technical debt. If needed, the code history can be found in version control.
- //if (!localStorage.getItem("did")) { - localStorage.setItem("did", visitorId); - //}
69-71
: Use optional chaining for better readability.Replace multiple logical AND operators with optional chaining for a more concise and modern approach.
- window.telemetry && - window.telemetry.syncEvents && - window.telemetry.syncEvents(); + window.telemetry?.syncEvents?.();🧰 Tools
🪛 Biome (1.9.4)
[error] 69-71: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
src/views/Practice/Practice.jsx (1)
566-569
: Consider removing the mechanism ID when empty.Instead of storing an empty string, consider removing the item from localStorage when mechanism ID is not available. This prevents potential issues with empty string values being interpreted as valid mechanism IDs.
- localStorage.setItem("mechanism_id", (mechanism && mechanism.id) || ""); + if (mechanism?.id) { + localStorage.setItem("mechanism_id", mechanism.id); + } else { + localStorage.removeItem("mechanism_id"); + }🧰 Tools
🪛 Biome (1.9.4)
[error] 567-567: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
package.json
(1 hunks)src/App.js
(2 hunks)src/components/Practice/Mechanics3.jsx
(2 hunks)src/components/Practice/Mechanics4.jsx
(4 hunks)src/services/telementryService.js
(2 hunks)src/utils/VoiceAnalyser.js
(1 hunks)src/views/Practice/Practice.jsx
(7 hunks)
🧰 Additional context used
🪛 Biome (1.9.4)
src/views/Practice/Practice.jsx
[error] 567-567: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
src/App.js
[error] 69-71: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
src/services/telementryService.js
[error] 31-31: Change to an optional chain.
Unsafe fix: Change to an optional chain.
(lint/complexity/useOptionalChain)
🔇 Additional comments (10)
src/App.js (2)
11-11
: LGTM: Telemetry SDK import updated.The import statement has been correctly updated to use the new telemetry SDK.
17-22
: LGTM: Device identification logic improved.The device identification logic has been enhanced to:
- Accept a
visitorId
parameter ininitService
- Use a consistent fallback mechanism with localStorage
src/components/Practice/Mechanics4.jsx (1)
51-52
: LGTM: Next button state management props added.The new props enhance the component's ability to manage next button state across components.
src/components/Practice/Mechanics3.jsx (1)
59-60
: LGTM: Next button state management props added.The new props are consistently added across mechanics components, maintaining a unified approach to next button state management.
src/utils/VoiceAnalyser.js (1)
365-365
: LGTM: Mechanism identification added to request payload.The mechanics_id is correctly retrieved from localStorage with a proper fallback to an empty string.
src/views/Practice/Practice.jsx (4)
897-898
: LGTM!The next button state management props are correctly passed to the Mechanics3 component.
942-943
: LGTM!The next button state management props are correctly passed to the Mechanics4 component.
1069-1070
: LGTM!The next button state management props are correctly passed to the Mechanics6 component.
1132-1133
: LGTM!The next button state management props are correctly passed to the Mechanics6 component.
package.json (1)
16-16
: Verify the stability of the new telemetry SDK.The package version (0.0.32) indicates early development stage. Please ensure:
- The package is stable enough for production use
- Breaking changes are documented
- Migration guide from
@project-sunbird/telemetry-sdk
is availableRun the following script to check the package details:
{selectedWords?.map((elem, ind) => ( | ||
<span | ||
key={ind} |
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.
🛠️ Refactor suggestion
Use stable unique identifiers as keys instead of array indices.
Using array indices as keys in React's map function is an anti-pattern that can lead to rendering issues and inefficient updates. Consider using stable unique identifiers from the data if available.
If the elements have unique properties, use them as keys:
- {selectedWords?.map((elem, ind) => (
- <span key={ind}
+ {selectedWords?.map((elem, ind) => (
+ <span key={`${elem}-${ind}`}
- {words?.map((elem, ind) => (
- <React.Fragment key={ind}>
+ {words?.map((elem, ind) => (
+ <React.Fragment key={`${elem}-${ind}`}>
Also applies to: 273-274
import { CsTelemetryModule } from "@project-sunbird/client-services/telemetry"; | ||
|
||
import { uniqueId } from './utilService'; | ||
import { jwtDecode } from '../../node_modules/jwt-decode/build/cjs/index'; | ||
import { uniqueId } from "./utilService"; | ||
import { jwtDecode } from "../../node_modules/jwt-decode/build/cjs/index"; |
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.
🛠️ Refactor suggestion
Simplify the jwt-decode import path.
The import path for jwt-decode is unnecessarily specific and could break if the package structure changes.
-import { jwtDecode } from "../../node_modules/jwt-decode/build/cjs/index";
+import { jwtDecode } from "jwt-decode";
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
import { CsTelemetryModule } from "@project-sunbird/client-services/telemetry"; | |
import { uniqueId } from './utilService'; | |
import { jwtDecode } from '../../node_modules/jwt-decode/build/cjs/index'; | |
import { uniqueId } from "./utilService"; | |
import { jwtDecode } from "../../node_modules/jwt-decode/build/cjs/index"; | |
import { CsTelemetryModule } from "@project-sunbird/client-services/telemetry"; | |
import { uniqueId } from "./utilService"; | |
import { jwtDecode } from "jwt-decode"; |
Summary by CodeRabbit
Release Notes
Dependencies
@project-sunbird/telemetry-sdk
to@tekdi/all-telemetry-sdk
New Features
Technical Improvements
Code Maintenance
The update focuses on improving telemetry tracking and component interaction management.