fix(app): server validation hangs indefinitely + stale cache causes false positives on Android

Open Beginner friendly
#1,193 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
85/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
typescript
Domain
mobile-dev

Research direction

Start in packages/happy-app/sources/app/(app)/server.tsx at validateServer() and inspect how the Server Config screen handles its fetch and validating state. Add the specified timeout, cache-control headers, and timer cleanup, then verify that slow or unreachable servers stop validating and cached Android responses are not accepted.

Written by the indexing model from the issue text.

Description

Problem

When validating a server URL in the Server Config screen, two bugs affect Android users:

  1. Indefinite hang — if the server is unreachable or slow, fetch() has no timeout, leaving the UI permanently stuck in validating state.
  2. Stale cache — Android WebView can serve a cached 200 OK from a previous successful check, causing a dead server to pass validation.

Both issues are reproducible on real Android devices, especially over slow links or when the VPS goes offline.

Root Cause

validateServer() in packages/happy-app/sources/app/(app)/server.tsx uses a bare fetch() with no abort signal and no cache-control headers:

const response = await fetch(url, {
    method: 'GET',
    headers: { 'Accept': 'text/plain' }
});

Fix

  • Wrap in AbortController with a 10-second timeout
  • Add Cache-Control: no-cache + Pragma: no-cache headers
  • clearTimeout() in finally block to prevent timer leaks

Affected File

packages/happy-app/sources/app/(app)/server.tsx

Dominant language
TypeScript
Stars
23.8k
Forks
2k
Avg merge
2d 16h
Merged PRs (30d)
13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from slopus/happy

All issues in slopus/happy

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.