Fix 'Error resolving revision' flash after package creation#4778
Fix 'Error resolving revision' flash after package creation#4778sir-sigurd merged 3 commits intomasterfrom
Conversation
After packageConstruct mutation, the GraphCache has the new revision cached under revision(hashOrTag: "latest") but not under the specific hash. When the success dialog navigates to the package page using the specific hash, GraphCache returns a partial cache hit with revision: null. The code only checked `fetching` to show the loading placeholder, missing the partial cache case. This caused "Error resolving revision" to render until the background network fetch completed with the real data. Check for partial cache outcome (as the `fold` helper already does) to show the loading placeholder instead of the error. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review.
Tip: disable this comment in your organization's Code Review settings.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4778 +/- ##
==========================================
- Coverage 44.33% 44.32% -0.01%
==========================================
Files 813 813
Lines 32734 32736 +2
Branches 5723 5721 -2
==========================================
Hits 14511 14511
- Misses 16220 16224 +4
+ Partials 2003 2001 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Fixes a brief UI flash of “Error resolving revision” after creating a package by treating URQL/GraphCache “partial” cache hits as a loading state when navigating to the newly created package revision.
Changes:
- Detect URQL partial-cache outcomes for the revision query and render the loading placeholder instead of the error state.
- Add a changelog entry describing the fix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| catalog/app/containers/Bucket/PackageTree/PackageTree.tsx | Treats cacheOutcome === 'partial' as loading for the revision query to prevent an error flash. |
| catalog/CHANGELOG.md | Adds a “Fixed” entry for the navigation flash issue. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use the established fold pattern for consistency with the rest of the codebase. fold handles partial cache hits as the fetching state, which is the actual fix for the "Error resolving revision" flash. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
After
packageConstructmutation, the GraphCache has the new revision cached underrevision(hashOrTag: "latest")but not under the specific hash. When the success dialog navigates to the package page using the specific hash, GraphCache returns a partial cache hit withrevision: null.The code only checked
fetchingto show the loading placeholder, missing the partial cache case. This caused "Error resolving revision" to render until the background network fetch completed with the real data.Fix: Check for partial cache outcome (as the
foldhelper already does) to show the loading placeholder instead of the error.TODO
🤖 Generated with Claude Code
Greptile Summary
This PR fixes a brief "Error resolving revision" flash that appeared when navigating to a just-created package. It replaces manual
fetching/error/datachecks with the existingGQL.foldhelper, which correctly handles urql GraphCache partial cache hits.Root cause: After a
packageConstructmutation, GraphCache has the revision cached underrevision(hashOrTag: "latest")but not under the specific hash. Navigating to the specific hash returns a partial cache hit (cacheOutcome === 'partial') withrevision: null. The old imperative checks only gated onfetching, so the partial cache response fell through to renderPackageTreewith anullrevision, triggering the error display.Fix:
GQL.fold(inutils/GraphQL/wrappers.ts, line 96) already detectscacheOutcome === 'partial'and routes it to thefetchinghandler by default, showing the loading placeholder until the real network response arrives. Switching toGQL.foldis therefore both the idiomatic pattern in this codebase and the correct solution.Additional changes:
{' '}between the<M.Box>close tag and "could"), which is a no-op in rendering but cleaner formatting.Confidence Score: 5/5
GQL.foldalready handles the partial cache case correctly (confirmed by readingwrappers.tsline 96). The fix is consistent with how other components in the codebase usefold. No new logic is introduced, no data paths are changed, and the only behavioral delta is showing a loading placeholder instead of a broken UI during the brief window between navigation and the real network response.Important Files Changed
PackageTreeQueriesto useGQL.fold, which correctly treats partial cache hits (cacheOutcome === 'partial') as a fetching state, preventing the "Error resolving revision" flash when navigating to a newly-created package.Sequence Diagram
sequenceDiagram participant User participant Dialog as Success Dialog participant Router participant PkgTreeQueries as PackageTreeQueries participant GraphCache as urql GraphCache participant Network User->>Dialog: packageConstruct mutation succeeds Dialog->>Router: Navigate to /pkg/:hash (specific hash) Router->>PkgTreeQueries: render with hashOrTag=hash PkgTreeQueries->>GraphCache: REVISION_QUERY (hashOrTag=hash) GraphCache-->>PkgTreeQueries: cacheOutcome='partial', revision=null Note over PkgTreeQueries: OLD: fetching=false → shows broken UI<br/>NEW: GQL.fold detects partial → shows Placeholder GraphCache->>Network: background fetch (hashOrTag=hash) Network-->>GraphCache: full revision data GraphCache-->>PkgTreeQueries: cacheOutcome='hit', revision={...} PkgTreeQueries-->>User: renders PackageTree correctlyReviews (2): Last reviewed commit: "Refactor PackageTreeQueries to use GQL.f..." | Re-trigger Greptile