YPE-1565: Show error when YouVersionProvider has no appKey#264
YPE-1565: Show error when YouVersionProvider has no appKey#264cameronapak wants to merge 1 commit into
Conversation
Render a styled "Missing app key" message instead of a blank page; hooks provider throws for hooks-only consumers. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 6cd9b71 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 |
| role="alert" | ||
| aria-live="polite" |
There was a problem hiding this comment.
role="alert" already carries an implicit aria-live="assertive" per the WAI-ARIA spec. Adding aria-live="polite" overrides that implicit value, which downgrades the announcement urgency — screen readers will wait for a pause in speech instead of interrupting immediately. For a configuration error that prevents the app from functioning, assertive is the right level. Remove the explicit aria-live attribute so the native alert role behaviour is preserved.
| role="alert" | |
| aria-live="polite" | |
| role="alert" |
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/ui/src/components/missing-app-key.tsx
Line: 24-25
Comment:
`role="alert"` already carries an implicit `aria-live="assertive"` per the WAI-ARIA spec. Adding `aria-live="polite"` overrides that implicit value, which downgrades the announcement urgency — screen readers will wait for a pause in speech instead of interrupting immediately. For a configuration error that prevents the app from functioning, assertive is the right level. Remove the explicit `aria-live` attribute so the native alert role behaviour is preserved.
```suggestion
role="alert"
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Empty/missing
appKeyrendered a blank page. Now: UI provider shows a styled "Missing app key" message; hooks provider throws.MissingAppKeypanel + Storybook storyYPE-1565
🤖 Generated with Claude Code
Greptile Summary
Replaces the silent blank-page failure when
YouVersionProviderreceives a missing or emptyappKeywith explicit, user-facing feedback. The UI package renders a styled, i18n-aware "Missing app key" panel; the hooks-only base provider throws a descriptive error for non-UI consumers.MissingAppKeycomponent added with light/dark theming, ARIArole="alert", and translations for EN/ES/FR; the UIYouVersionProvidershort-circuits before calling the base provider whenappKeyis absent.Confidence Score: 4/5
Safe to merge — the change is well-scoped and well-tested; one minor ARIA attribute conflict in the new component is the only issue found.
The two-layer guard (UI provider returns a styled panel; hooks provider throws) is a clean design and the tests cover all three invalid-key shapes. The only notable issue is that
aria-live="polite"on therole="alert"element overrides the role's implicit assertive live region, making screen-reader announcements less urgent than intended for a configuration error. This is an accessibility polish item that doesn't affect functional correctness.packages/ui/src/components/missing-app-key.tsx — the redundant
aria-liveattribute; all other files look correct.Important Files Changed
aria-live="polite"that conflicts with the implicit assertive live region ofrole="alert"useEffectis correctly called before the early return, so no Rules of Hooks violationappKey ?? ''to YouVersionProvider so a missing env var triggers the new error UI instead of a blank pageFlowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[YouVersionProvider UI] --> B{appKey empty\nor missing?} B -- Yes --> C[Render YvStyles + MissingAppKey panel] B -- No --> D[BaseYouVersionProvider hooks] D --> E{appKey empty\nor missing?} E -- Yes --> F[throw Error\nnon-empty appKey required] E -- No --> G[Render children\nwith context] C --> H[role=alert panel\nshown to user] F --> I[Error Boundary\nor app crash]Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "YPE-1565: fix(ui): show error when YouVe..." | Re-trigger Greptile