Skip to content

feat(popup): extract connectivity-error-to-popup classification into a shared hook - #27

Merged
Andreas-Garcia merged 5 commits into
mainfrom
extract-connectivity-error-popup-hook
Aug 15, 2026
Merged

feat(popup): extract connectivity-error-to-popup classification into a shared hook#27
Andreas-Garcia merged 5 commits into
mainfrom
extract-connectivity-error-popup-hook

Conversation

@Andreas-Garcia

Copy link
Copy Markdown
Member

Summary

  • grow-the-music-tree-frontend and hear-the-music-tree-frontend each carry a byte-for-byte duplicate of the connectivity-error → popup classification logic in their own AppContent.tsx, including the same bug: an AuthRequired error on a route that doesn't require auth (e.g. a public reference page) was silently dropped instead of surfacing a popup (fixed one-off in grow-frontend PR #123).
  • Adds useConnectivityErrorPopup to app-kit's popup subpath: owns the error-type/route-requirement classification and the redisplay-dedup logic, while apps supply their own branded popup components via a renderers object (renderAuthPopup, renderInternalErrorPopup, etc.) — so this fix (and any future one) only needs to land once.
  • No behavior change here by itself; grow-frontend and hear-frontend will switch AppContent.tsx to consume this hook once a new app-kit version is published.

Test plan

  • useConnectivityErrorPopup.test.tsx covers: AuthRequired on an auth-required route → renderAuthPopup; AuthRequired on a route that doesn't require auth → renderInternalErrorPopup (the regression case); popup hides once the connectivity error clears.
  • CI (lint/build/test) on this PR

🤖 Generated with Claude Code

…a shared hook

grow-frontend and hear-frontend each carry a byte-for-byte copy of this
classification logic in their own AppContent.tsx, including the same bug
(an AuthRequired error on a route that doesn't require auth was silently
dropped instead of surfacing a popup). Centralizing it here means that
class of bug only needs fixing once; apps still own their own popup
components via the renderers they pass in.
@vercel

vercel Bot commented Aug 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app-kit-playground Ready Ready Preview Aug 15, 2026 7:22pm

The transport barrel re-exports fetch-wrapper, useFetchWrapper, site-urls,
and query-client too; pulling it in dragged those largely-untested modules
into vitest's all:false coverage set and tripped the repo's 80% threshold.
Function coverage was failing CI (55.55% < 80%) because the prior tests
only exercised the AuthRequired branches, leaving the hook's other
renderer branches and most app-error classes' constructors unexercised.
Functions coverage was still short (77.77% < 80%): the two onClose
callbacks passed to the Spotify/Google auth-error renderers were never
invoked, and importing app-error.ts directly (instead of via a barrel)
brought its previously-untested branches (InvalidInputError.toString(),
BackendError's backendMessage override, BackendSpotifyUserNotAllowlistedError,
getSpotifyAllowlistMailtoHref) into the coverage-counted set.
vi.mocked() casts the renderer mocks so direct .mock access type-checks.
@Andreas-Garcia
Andreas-Garcia merged commit 158eb6c into main Aug 15, 2026
4 checks passed
@Andreas-Garcia
Andreas-Garcia deleted the extract-connectivity-error-popup-hook branch August 15, 2026 19:59
Andreas-Garcia added a commit that referenced this pull request Aug 15, 2026
Adds the shared useConnectivityErrorPopup hook (#27).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant