Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor profile screen to use new pager and react-query #1870

Merged
merged 4 commits into from
Nov 13, 2023
Merged

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Nov 10, 2023

  • Updates profile screen to use the new <PagerWithHeader>
  • Updates profile screen to use react-query
  • Introduces a profile shadow cache, similar to the posts shadow cache

Still todo in followup PRs:

  • Profile preview
  • Edit profile modal
  • Profile avatar lightbox
  • Dynamic tabs
  • Feed tab behaviors
  • Lists tab
  • Feeds tab

@pfrazee pfrazee changed the title [WIP] New pager in profile Refactor profile screen to use new pager and react-query Nov 13, 2023
@pfrazee pfrazee marked this pull request as ready for review November 13, 2023 17:21
useEffect(() => {
// dont fire on first run to avoid needless re-renders
if (!firstRun.current) {
setState({ts: Date.now(), value: fromProfile(profile)})
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can you describe how you want this to work? Generally we shouldn't be setting state from effects. If there's a need to adjust state, the canonical way is to do this. But I think I'm not quite following the logic in general so I want to understand the intended behavior.

firstRun.current = false
}, [profile])

return state.ts > ifAfterTS ? mergeShadow(profile, state.value) : profile
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should probably useMemo this.

@pfrazee pfrazee merged commit e193893 into main Nov 13, 2023
3 of 4 checks passed
@pfrazee pfrazee deleted the profile-tabs branch November 13, 2023 18:35
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.

2 participants