[BUG]: Profile page misclassifies RPC failures as not found or stays loading

Open
#175 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@JANAKIRAM218 is already working on this.

Since Nov 19, 2026.

  • #180 by @JANAKIRAM218 — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
70/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active

Research direction

Start with app/profile/page.tsx and hooks/useIdentityReads.ts, then trace how the username resolution and profile queries expose their loading, error, and data states. Add regression coverage for failed and empty query results, retries, and cached data during failed background refetches; done means failures show a retryable error state while successful empty results show “Profile not found.”

Written by the indexing model from the issue text.

Description

bug enhancement
Bug Description

The public profile page does not properly distinguish between a profile that genuinely does not exist and a contract read that fails due to an RPC or network error.

When username resolution fails during an initial RPC request, the page can fall through to the Profile not found condition and incorrectly inform the user that no profile exists.

When navigating directly using a profile token ID (pf-...), a failed getProfile request can leave the page stuck displaying Loading profile… because the loading condition continues to evaluate as true when the token ID exists but profile data is unavailable.

Affected Files

  • app/profile/page.tsx
  • hooks/useIdentityReads.ts

Actual Behavior

  • Username resolution failures can cause the page to display Profile not found, even though the profile's existence was never successfully verified.
  • Direct profile-token-ID navigation can remain stuck on Loading profile… after the getProfile request fails.
  • The page does not explicitly distinguish query failures from successful empty results in these code paths.

Expected Behavior

  • A successful query returning no profile should display Profile not found.
  • An RPC or network failure should display an appropriate error state instead of incorrectly claiming the profile does not exist.
  • Failed initial profile reads should not leave the page stuck in an infinite loading state.
  • Users should be able to retry failed requests.
  • Previously cached profile data should remain visible if a background refetch fails.

Technical Details

The page currently uses the following query states:

const {
  data: resolvedTokenId,
  isLoading: isResolvingUsername,
} = useResolveUsername(username);
const {
  data: profileData,
  isLoading: isProfileLoading,
} = useProfile(profileTokenId);

The loading condition also includes:

(profileTokenId !== undefined && profileData === undefined)

This can keep the page in its loading state after a direct profile read has failed.

Additionally, the not-found condition:

if (!profileData || !profileData.name)

does not distinguish between a successful empty response and a failed contract read when the username resolution query has errored.

Suggested Solution

  • Expose and handle isError and error states from the relevant React Query hooks.
  • Distinguish RPC/network errors from successfully resolved nonexistent profiles.
  • Prevent failed initial queries from keeping the page in an indefinite loading state.
  • Provide an error state with a retry action.
  • Preserve existing cached profile data during background refetch failures.

Regression Tests

  • Username resolution succeeds and the profile loads.
  • Username resolution successfully returns no profile.
  • Username resolution fails due to an RPC/network error.
  • Profile lookup succeeds for an existing profile token ID.
  • Profile lookup returns empty/nonexistent profile data.
  • Profile lookup fails due to an RPC/network error.
  • Background refetch fails while cached profile data exists.
  • A failed request recovers after retry or network restoration.

This report is based on inspection of the relevant query and rendering paths. Runtime reproduction under a deliberately failing RPC endpoint has not yet been performed.

Steps to Reproduce
Scenario 1: Username-based profile lookup
  1. Navigate to a public profile using a username, for example /profile?u=username.
  2. Simulate an RPC failure or temporary network interruption before the username resolution request completes.
  3. Allow the query to transition out of its initial loading state.
  4. Observe the page.
Scenario 2: Profile token ID lookup
  1. Navigate directly to a profile using its token ID, for example /profile?u=pf-123.
  2. Cause the initial getProfile contract read to fail due to an RPC or network error.
  3. Wait for the failed query to settle.
  4. Observe the loading state.
Environment Details

No response

Impact

Medium - Feature works but has issues

Code of Conduct
  • I have joined the Discord server and will post updates there
  • I have searched existing issues to avoid duplicates
Dominant language
TypeScript
Stars
5
Forks
20
Avg merge
2d 15h
Merged PRs (30d)
11

Getting set up

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 StabilityNexus/IdentityTokens-EVM-Frontend

All issues in StabilityNexus/IdentityTokens-EVM-Frontend

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.