Skip to content

User profile (migration 6/8) - #694

Open
charityquinn-cognition wants to merge 3 commits into
devin/react-migration-5-item-detailsfrom
devin/react-migration-6-user
Open

User profile (migration 6/8)#694
charityquinn-cognition wants to merge 3 commits into
devin/react-migration-5-item-detailsfrom
devin/react-migration-6-user

Conversation

@charityquinn-cognition

@charityquinn-cognition charityquinn-cognition commented Aug 25, 2026

Copy link
Copy Markdown

Summary

Stacked on #693. Ports user/user.component to src-react/user/User.tsx and adds /user/:id, completing the route surface — the author links added in PR5 now resolve.

  • fetchUser(id) in an effect keyed on the route param, same ignore staleness guard; error message is byte-identical (Could not load user <id>.).
  • Markup matches the template exactly: mobile item-header with the back button (navigate(-1)), main-details with id / karma / Created {created}, and the other-details block only when about is present. That about HTML goes through PR5's sanitizeHtml() wrapper — it's profile-owner-authored, and Angular's [innerHTML] sanitized it, so rendering it raw would have been a regression rather than parity. The Angular user view has no main-content wrapper, so neither does this one.
  • user.component.scss is copied unchanged except its :host >>> pre rule, rescoped to .other-details pre for the same reason as PR5's comment styles.

Verified: yarn react:build passes; the error path renders the message rather than a blank page.

Two things left as-is, both matching the original: a failed load after a successful one keeps the previous profile on screen (Angular only assigned user on success, and ItemDetails behaves the same way), and a non-numeric route param is passed through to the API.

One gap worth flagging: the upstream API's /user/<id> endpoint currently 404s for every id tried (pg, dang, real story authors), so the populated profile — karma, created, about — could not be verified against live data. That's a node-hnapi outage, not a code issue; the loading/error paths and markup are verified, the happy path is not.

Devin-Org: engineering

Link to Devin session: https://app.devin.ai/sessions/1ff25c6cf2f949458f82cc596fc79c65
Requested by: @charityquinn-cognition


Open in Devin Review

@devin-ai-integration

Copy link
Copy Markdown

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Open in Devin Review

Comment thread src-react/user/User.tsx
Comment on lines +17 to +36
useEffect(() => {
let ignore = false;
setErrorMessage('');

fetchUser(userID)
.then((nextUser) => {
if (!ignore) {
setUser(nextUser);
}
})
.catch(() => {
if (!ignore) {
setErrorMessage(`Could not load user ${userID}.`);
}
});

return () => {
ignore = true;
};
}, [userID]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 Info: Stale profile persists across navigation

On userID change the effect resets errorMessage but never clears user, so navigating from a loaded profile to one that errors keeps the previous profile on screen. This mirrors ItemDetails and the Angular original.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentional — as you note, it matches the Angular original (which also only assigned user on success) and the sibling ItemDetails. Changing it would be a behavior change rather than a port, so I'm leaving it consistent across the three views; worth a follow-up if the stale-view-on-error transition is considered a bug in its own right.

Comment thread src-react/user/User.tsx Outdated
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/react-migration-6-user branch from 6af712a to fb9e1aa Compare August 25, 2026 22:29
devin-ai-integration Bot and others added 3 commits August 25, 2026 22:47
Co-Authored-By: Charity Quinn <charity.quinn@cognition.ai>
Co-Authored-By: Charity Quinn <charity.quinn@cognition.ai>
Co-Authored-By: Charity Quinn <charity.quinn@cognition.ai>
@devin-ai-integration
devin-ai-integration Bot force-pushed the devin/react-migration-6-user branch from fb9e1aa to 1754abb Compare August 25, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant