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
feat: add lazy userpreview for all profiles #3884
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
This comment was marked as abuse.
alt={formatHandle(lazyProfile?.handle)} | ||
/> | ||
); | ||
const [fakeLoading, setFakeLoading] = useState<boolean>(loading); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can use different name imo
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
if (!handle && !profile) { | ||
throw new Error('UserPreview needs to receive a profile or a handle'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just return null!
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this PR do?
🤖 Generated by Copilot and @Clueed at ac463fb
This pull request make UserPreview always fetch from network (f77ad07).
Instead, the passed in profile is used as fallback when there is a network error (ac463fb).
Related issues
Fixes #3723
Type of change
Explanation of the changes
🤖 Generated by Copilot at ac463fb
UserPreview
component to useuseProfileLazyQuery
hook andlazyProfile
state variable to fetch profile data on hover and improve performance (link)isVerified
andhasMisused
functions to avoid errors whenlazyProfile
orlazyProfile.id
is undefined (link)UserProfileContent
component fromUserPreview
to simplify and reuse profile content rendering (link)lazyProfile
prop withcompositeProfile
prop inSuperFollow
,Follow
, and bio rendering to ensure latest profile data is passed and shown (link, link, link, link)lazyProfile
prop withcompositeProfile
prop in total following and followers count rendering to ensure count is updated with fetched profile data (link, link)onPreviewStart
function to useloadProfile
hook without awaiting or setting loading state and move loading and profile content rendering logic toPreview
component (link)Preview
Screen.Recording.2023-10-05.at.12.34.08.mov
Emoji
🚀🧑💻🖼️
/claim #3723