-
Notifications
You must be signed in to change notification settings - Fork 0
YPE-1099: React-Hooks-Add useLanguage hook to get information for a specific language. #111
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
base: main
Are you sure you want to change the base?
Conversation
- fix languages api response data schema - update existing useLanguages tests - update mock data for languages - update vitest coverage to include all files
- add endpoint to retrieve a specific language data - abstract the language client logic into its own hook - create tests for get language endpoint - move tests for language client from useLanguages tests to its own file
🦋 Changeset detectedLatest commit: 18efea4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Greptile OverviewGreptile SummaryAdded Key Changes
ArchitectureThe implementation properly follows the established monorepo patterns: core package contains the API client and schemas (pure TypeScript), hooks package provides React integration, and workspace dependencies use the Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant App as React Component
participant useLanguage as useLanguage Hook
participant useLanguagesClient as useLanguagesClient Hook
participant useApiData as useApiData Hook
participant LanguagesClient as LanguagesClient
participant ApiClient as ApiClient
participant API as Platform API
App->>useLanguage: Call useLanguage(languageId, options)
useLanguage->>useLanguagesClient: Get LanguagesClient instance
useLanguagesClient->>YouVersionContext: useContext()
YouVersionContext-->>useLanguagesClient: {appKey, apiHost, installationId}
useLanguagesClient->>ApiClient: new ApiClient(config)
ApiClient-->>useLanguagesClient: apiClient instance
useLanguagesClient->>LanguagesClient: new LanguagesClient(apiClient)
LanguagesClient-->>useLanguagesClient: languagesClient instance
useLanguagesClient-->>useLanguage: Return memoized client
useLanguage->>useApiData: Call with fetch function and deps
useApiData->>LanguagesClient: getLanguage(languageId)
LanguagesClient->>LanguagesClient: Validate languageId (Zod schema)
LanguagesClient->>ApiClient: get(`/v1/languages/${languageId}`)
ApiClient->>API: HTTP GET /v1/languages/{languageId}
API-->>ApiClient: Language data
ApiClient-->>LanguagesClient: Language object
LanguagesClient-->>useApiData: Language object
useApiData-->>useLanguage: {data, loading, error, refetch}
useLanguage-->>App: {language, loading, error, refetch}
|
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.
1 file reviewed, 1 comment
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/hooks/src/index.ts
Line: 20:20
Comment:
Missing exports for new hooks - add these lines:
```suggestion
export * from './useLanguages';
export * from './useLanguage';
export * from './useLanguageClient';
```
How can I resolve this? If you propose a fix, please make it concise. |
77ec682 to
75369cb
Compare
b6ef626 to
18efea4
Compare
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.
No files reviewed, no comments
Add a hook to get a specific language.