replaced local storage with session storage for chat language and has… - #250
Conversation
…SelectedChatLanguage
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughMigrates language state access across the app from the local site-data store to a session-scoped store by replacing Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
🧠 Learnings used✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (4)
src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/DefineChallenge.jsx (1)
25-25: Consider using a consistent selector pattern.The current pattern
useSiteDataSessionStore().getChatLanguage()works but is inconsistent with other files in this PR that use the selector patternuseSiteDataSessionStore(state => state.chatLanguage).For consistency across the codebase, consider aligning with the selector pattern used elsewhere:
♻️ Suggested refactor for consistency
- const [languageToUse, setLanguageToUse] = useState( - useSiteDataSessionStore().getChatLanguage() || "en" - ); + const chatLanguage = useSiteDataSessionStore(state => state.chatLanguage); + const [languageToUse, setLanguageToUse] = useState( + chatLanguage || "en" + );Also applies to: 88-89
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/DefineChallenge.jsx` at line 25, Replace the direct method call pattern useSiteDataSessionStore().getChatLanguage() with the selector pattern used elsewhere: useSiteDataSessionStore(state => state.chatLanguage); update all occurrences (including the ones around the referenced lines 88-89) so they consistently use the selector form and reference the chatLanguage property instead of calling getChatLanguage().src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/ChatBox.jsx (1)
60-60: Consider using selector pattern for consistency.This uses
useSiteDataSessionStore().getChatLanguage()while other components use the selector patternuseSiteDataSessionStore(state => state.chatLanguage). The selector pattern is more performant as it subscribes only to the specific state slice.♻️ Suggested change for consistency and performance
- const languageToUse = useSiteDataSessionStore().getChatLanguage() || "en"; + const languageToUse = useSiteDataSessionStore(state => state.chatLanguage) || "en";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/ChatBox.jsx` at line 60, The code uses useSiteDataSessionStore().getChatLanguage() to initialize languageToUse which bypasses the selector pattern used elsewhere; replace that call with the selector pattern (useSiteDataSessionStore(state => state.chatLanguage) || "en") in ChatBox.jsx, remove or stop using getChatLanguage here and ensure languageToUse derives from the selector so the component only subscribes to the chatLanguage slice for better performance and consistency.src/components/ShowPageButton.jsx (1)
5-5: Minor: Inconsistent import path.This file uses a direct path import
from "store/slices/siteData/siteDataSession"while other files in this PR use the barrel importfrom "store". Consider using the consistent barrel import for maintainability.♻️ Suggested change for consistency
-import useSiteDataSessionStore from "store/slices/siteData/siteDataSession" +import { useSiteDataSessionStore } from "store"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/ShowPageButton.jsx` at line 5, Update the import in ShowPageButton.jsx to use the project's barrel export instead of the deep path: replace the direct import of useSiteDataSessionStore from "store/slices/siteData/siteDataSession" with the barrel import from "store" so it matches other files and centralizes exports (locate the import statement that references useSiteDataSessionStore and change its module specifier to "store").src/pages/ai-creation/components/textarea-with-mic/index.jsx (1)
8-8: Consider using selector pattern for consistency.Same observation as
ChatBox.jsx- this usesuseSiteDataSessionStore().getChatLanguage()while most other components use the selector pattern. Consider aligning with the selector pattern used elsewhere.♻️ Suggested change
- const languageToUse = useSiteDataSessionStore().getChatLanguage() || "en"; + const languageToUse = useSiteDataSessionStore(state => state.chatLanguage) || "en";Also applies to: 58-58
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/pages/ai-creation/components/textarea-with-mic/index.jsx` at line 8, The component currently calls useSiteDataSessionStore().getChatLanguage() directly; change it to the selector pattern used elsewhere (e.g., ChatBox.jsx) by selecting the getter or value via useSiteDataSessionStore(selector) — for example useSiteDataSessionStore(state => state.getChatLanguage) and then invoke it, or useSiteDataSessionStore(state => state.getChatLanguage()) to obtain the chat language directly; update both occurrences (including the one at line 58) so the hook is called with a selector function instead of accessing the store instance directly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/Form/FormData.jsx`:
- Line 3: Remove the unused import useSiteDataSessionStore from the FormData
component: locate the import statement referencing useSiteDataSessionStore in
FormData.jsx and delete it so only the used imports (e.g., useTranslation from
react-i18next) remain; ensure there are no remaining references to
useSiteDataSessionStore in the component to avoid breaking imports.
---
Nitpick comments:
In `@src/components/ShowPageButton.jsx`:
- Line 5: Update the import in ShowPageButton.jsx to use the project's barrel
export instead of the deep path: replace the direct import of
useSiteDataSessionStore from "store/slices/siteData/siteDataSession" with the
barrel import from "store" so it matches other files and centralizes exports
(locate the import statement that references useSiteDataSessionStore and change
its module specifier to "store").
In `@src/pages/ai-creation/components/textarea-with-mic/index.jsx`:
- Line 8: The component currently calls
useSiteDataSessionStore().getChatLanguage() directly; change it to the selector
pattern used elsewhere (e.g., ChatBox.jsx) by selecting the getter or value via
useSiteDataSessionStore(selector) — for example useSiteDataSessionStore(state =>
state.getChatLanguage) and then invoke it, or useSiteDataSessionStore(state =>
state.getChatLanguage()) to obtain the chat language directly; update both
occurrences (including the one at line 58) so the hook is called with a selector
function instead of accessing the store instance directly.
In
`@src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/ChatBox.jsx`:
- Line 60: The code uses useSiteDataSessionStore().getChatLanguage() to
initialize languageToUse which bypasses the selector pattern used elsewhere;
replace that call with the selector pattern (useSiteDataSessionStore(state =>
state.chatLanguage) || "en") in ChatBox.jsx, remove or stop using
getChatLanguage here and ensure languageToUse derives from the selector so the
component only subscribes to the chatLanguage slice for better performance and
consistency.
In
`@src/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/DefineChallenge.jsx`:
- Line 25: Replace the direct method call pattern
useSiteDataSessionStore().getChatLanguage() with the selector pattern used
elsewhere: useSiteDataSessionStore(state => state.chatLanguage); update all
occurrences (including the ones around the referenced lines 88-89) so they
consistently use the selector form and reference the chatLanguage property
instead of calling getChatLanguage().
ℹ️ Review info
Configuration used: defaults
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (22)
package.jsonsrc/components/Form/FormData.jsxsrc/components/Header.jsxsrc/components/LanguageSelectionGrid.jsxsrc/components/LanguageSelector.jsxsrc/components/ShowPageButton.jsxsrc/hooks/useLanguage.jssrc/i18n.jssrc/pages/Login/commonPage.jsxsrc/pages/ShikshalokamVoiceChat/chat-container.jssrc/pages/ShikshalokamVoiceChat/dynamic-voice-chat.jssrc/pages/ShikshalokamVoiceChat/voice-chat.jssrc/pages/UnifiedChat/StoryActionsModule.jssrc/pages/UnifiedChat/UnifiedChat.jsxsrc/pages/UnifiedChat/UnifiedVoiceBasedChat.jsxsrc/pages/ai-creation/components/textarea-with-mic/index.jsxsrc/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/DefineChallenge.jsxsrc/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/StateMachineDefineChallenge.jsxsrc/pages/ai-creation/pages/shikshalokam-mitra/mitra-pages/components/ChatBox.jsxsrc/pages/shikshagraha-repository/listing/Filters.jsxsrc/pages/shikshalokamChat.jssrc/pages/ssoFlow.jsx
|
🧠 Learnings used✅ Actions performedReview triggered.
|
…SelectedChatLanguage
Summary by CodeRabbit
New Features
Chores