Keep signed-out food logs neutral - #24
Merged
Merged
Conversation
Start with a neutral sign-in state and wait for the authenticated identity event before loading private food logs.
Emit one authenticated event from refreshCurrentUser so private food logs load only after identity is confirmed, without duplicate reloads.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts the frontend’s signed-out experience so the food-log area starts in a neutral state and avoids fetching private log data during the public page mount, only loading logs after authentication is confirmed via /api/identity/me.
Changes:
- Centralize/authenticate the auth-state announcement so it fires after a successful
/api/identity/meresponse. - Initialize the food-log UI in a signed-out neutral state and remove the automatic logs fetch on mount.
- Rely on the auth-state change event to trigger private log loading instead of fetching logs unconditionally.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| frontend/components/XamanLoginPanel.tsx | Moves announceAuthState(true) to the /api/identity/me success path to ensure auth is announced only after session confirmation. |
| frontend/components/FoodSearchPlaceholder.tsx | Starts the log UI in a signed-out neutral state and removes the mount-time fetchLogs() call to avoid requesting private logs on public load. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Bind identity refreshes to their owning login or bridge lifecycle before announcing global auth state.
Remove the signed-out status as soon as authenticated log loading begins; restore it on a 401 response.
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
Why
A cold or unavailable backend must not turn the optional private log into a confusing public error, and private logs should load only after identity is confirmed.
Release gate
Merge only after repository, frontend, backend and WordPress release checks pass. Then deploy and verify signed-out, signed-in, logout and cold-start behavior.