Refine startup error handling to avoid false storage disconnect warnings#1164
Open
Refine startup error handling to avoid false storage disconnect warnings#1164
Conversation
|
A preview of 0e0510e is uploaded and can be seen here: ✨ https://revisit.dev/study/PR1164 ✨ Changes may take a few minutes to propagate. |
Contributor
There was a problem hiding this comment.
Pull request overview
Refines the participant startup flow to avoid showing “Storage Disconnected” for non–storage-engine startup errors (e.g., missing browser APIs or resume/participant lookup failures), while still surfacing actionable alerts when appropriate.
Changes:
- Adds
Shell.utilshelpers to safely readscreen.orientation, classify storage-engine startup failures, and build initial alert-modal state. - Extends
studyStoreCreatorto accept an optional initialalertModalstate and introduces a sharedAlertModalStatetype. - Updates
Shell.tsxto (a) avoidscreen.orientationruntime errors and (b) seed a normal alert modal for non-storage failures; adds focused unit tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/store/types.ts | Introduces AlertModalState type alias and uses it in StoreState. |
| src/store/store.tsx | Adds optional initialAlertModal parameter to seed initial store state; tightens setAlertModal payload typing. |
| src/components/Shell.utils.ts | New startup helper utilities (orientation, failure classification, error messaging, initial alert state). |
| src/components/Shell.utils.spec.ts | New Vitest coverage for the startup helper utilities. |
| src/components/Shell.tsx | Uses safe orientation accessor and improved startup error classification to prevent false “storage disconnected” warnings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Does this PR close any open issues?
Closes #1153
Give a longer description of what this PR addresses and why it's needed
This changes the participant startup flow so we only show Storage Disconnected for real storage-engine failures.
In Shell.tsx, startup metadata collection now safely handles missing browser APIs like screen.orientation instead of throwing. Startup failures are classified from the actual storage engine state, and non-storage failures now seed a normal alert modal rather than incorrectly setting the storage-disconnected flag. In study dev mode, that alert shows the underlying error message; otherwise it stays generic or uses resume-specific copy when a participantId is present.
I also added a small optional initial-alert path to the store and added focused unit tests for the startup helper logic.
Provide pictures/videos of the behavior before and after these changes (optional)
Are there any additional TODOs before this PR is ready to go?
TODOs: