Fix indefinite chat loading by providing storage status context#845
Open
Fix indefinite chat loading by providing storage status context#845
Conversation
…rapper Wrap children with StorageStatusContext.Provider in PrivyProviderWrapper to ensure useStorageStatus() hook receives the correct storage status value. This change fixes issues where components relying on useStorageStatus (such as useAuth) would not get the correct context when storage is blocked or in other states. Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
…g bug The `useStorageStatus()` hook was previously reading from a React context never provided for web users, causing the status to remain "checking" indefinitely. This led to `useAuth()` returning `loading: true` forever and the chat page stuck on "Initializing chat...". This commit wraps `WebPrivyProviderNoSSR` with `StorageStatusContext.Provider` in `PrivyProviderWrapper`, enabling proper storage status transitions from "checking" to "ready". Additional changes include: - Adding unit tests verifying context provision and blocked storage handling. - Adding a manual test page to observe the status and auth loading transitions. - Adding a verification guide document. - A static verification script to confirm correct fix implementation. This fixes the infinite loading problem on the chat page and ensures consistent authentication flow. Co-authored-by: terragon-labs[bot] <terragon-labs[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
What I changed
Privy provider wiring
Tests and verification helpers
Manual/verification aids
Why this fixes the issue
Changes overview (files touched)
Verification plan
Quick verification checklist
Related work
Notes
🌿 Generated by Terry
ℹ️ Tag @terragon-labs to ask questions and address PR feedback
📎 Task: https://www.terragonlabs.com/task/87da3187-c6e7-4958-8945-463d611bd9e4
Greptile Summary
Fixed indefinite loading on
/chatpage by ensuringStorageStatusContextis properly provided to all child components.Key Changes:
WebPrivyProviderNoSSRandDesktopAuthProviderNoSSRwithStorageStatusContext.Providerin all three render paths (desktop, blocked, ready)useStorageStatus()hook returns actual storage status instead of default"checking"valueHow This Fixes the Bug:
Previously,
useAuth()calleduseStorageStatus()which read from a context that was never provided at thePrivyProviderWrapperlevel. The context returned the default value"checking"indefinitely, causinguseAuth()to returnloading: trueforever and the chat page to show "Initializing chat..." with no way to proceed. By adding the context provider wrapper, the status now properly transitions from"checking"to"ready", allowing the auth flow to complete.Testing:
Confidence Score: 5/5
Important Files Changed
StorageStatusContext.Providerwrapper around web and desktop providers to fix missing context that caused infinite loadingSequence Diagram
sequenceDiagram participant ChatPage participant useAuth participant useStorageStatus participant PrivyProviderWrapper participant Context as StorageStatusContext participant WebProvider as WebPrivyProviderNoSSR rect rgb(255, 240, 240) Note over ChatPage,WebProvider: BEFORE FIX ChatPage->>useAuth: Get auth state useAuth->>useStorageStatus: Get storage status useStorageStatus->>Context: Read context Note over Context: No provider exists Context-->>useStorageStatus: Default value useStorageStatus-->>useAuth: Returns checking useAuth-->>ChatPage: Returns loading true Note over ChatPage: Infinite loading spinner end rect rgb(240, 255, 240) Note over ChatPage,WebProvider: AFTER FIX PrivyProviderWrapper->>Context: Create provider with checking PrivyProviderWrapper->>WebProvider: Render wrapped in context ChatPage->>useAuth: Get auth state useAuth->>useStorageStatus: Get storage status useStorageStatus->>Context: Read context Context-->>useStorageStatus: Returns checking useStorageStatus-->>useAuth: Returns checking useAuth-->>ChatPage: Returns loading true PrivyProviderWrapper->>PrivyProviderWrapper: useEffect executes PrivyProviderWrapper->>PrivyProviderWrapper: Check localStorage PrivyProviderWrapper->>Context: Update to ready ChatPage->>useAuth: Get auth state (rerender) useAuth->>useStorageStatus: Get storage status useStorageStatus->>Context: Read context Context-->>useStorageStatus: Returns ready useStorageStatus-->>useAuth: Returns ready useAuth-->>ChatPage: Returns loading false Note over ChatPage: Chat interface loads end