Fix blank page for new convention attendees after login#11787
Merged
Conversation
When a user logged in for the first time on a convention site, the appRootLoader correctly detected a missing profile, ran SetupMyProfile to create one, and redirected to /my_profile/setup. But on that redirect, MyProfileForm.loader ran MyProfileQuery with cache-first and got null back from the stale Apollo cache — the SetupMyProfile mutation result was stored under setupMyProfile.my_profile, leaving Convention.my_profile = null in the normalized cache untouched. A null reference is treated as a complete cache hit, so no network request was made. MyProfileForm.loader returned a 404, triggering the RouteErrorBoundary with a cryptic "[object Response]" message instead of the profile setup form. Fix by adding an update callback to the SetupMyProfile mutate() call. After the mutation succeeds, the callback patches Convention.my_profile in the normalized cache to reference the new UserConProfile entity. Subsequent cache-first queries then find a valid (but incomplete) reference and make a real network fetch for the full profile fields, letting MyProfileForm.loader succeed and the form render normally. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is |
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
appRootLoadercorrectly detected a missing profile, ranSetupMyProfile, and redirected to/my_profile/setup.MyProfileForm.loaderranMyProfileQuerywith the defaultcache-firstpolicy. BecauseSetupMyProfile's mutation result is stored undersetupMyProfile.my_profile, the Apollo normalized cache still hadConvention.my_profile = null. Anullreference is treated as a complete cache hit, so no network request was made. The loader returned a 404 response, which surfaced as aRouteErrorBoundaryerror (a cryptic[object Response]message) — effectively a blank/broken page instead of the profile setup form.updatecallback to theSetupMyProfilemutate()call inappRootLoader. After the mutation succeeds, the callback patchesConvention.my_profilein the normalized cache to reference the newly createdUserConProfileentity. Subsequentcache-firstqueries then find a valid (but incomplete) reference and correctly make a real network fetch for the full profile fields, allowingMyProfileForm.loaderto succeed and the form to render normally.Test plan
UserConProfilefor that convention (first-time attendee)/my_profile/setup) renders correctly after login instead of showing a blank page or errorneeds_update: trueand verify the profile edit form renders correctly🤖 Generated with Claude Code