Skip to content

Auto fetch followers#209

Merged
joshr4 merged 8 commits intomainfrom
auto-fetch-followers
Jan 17, 2025
Merged

Auto fetch followers#209
joshr4 merged 8 commits intomainfrom
auto-fetch-followers

Conversation

@joshr4
Copy link
Collaborator

@joshr4 joshr4 commented Jan 17, 2025

Description by Korbit AI

What change is being made?

Refactor to replace useNostrProfileEvent with useNostrProfile, adding caching and follow fetching functionalities.

Why are these changes being made?

The changes enhance code readability and maintainability by consolidating profile event retrieval into useNostrProfile. This includes improvements such as caching follow profiles for performance optimization, reducing redundancy by removing cache-related functions from several places, and ensuring streamlined profile data fetching logic across the application.

Is this description stale? Ask me to generate a new description by commenting /korbit-generate-pr-description

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Fix Detected
Performance Uniform Cache Staleness Strategy ▹ view
Files scanned
File Path Reviewed
components/LoggedInUserAvatar.tsx
hooks/nostrProfile/useSaveNostrProfile.ts
app/auth/welcome.tsx
components/PulseProfilePage.tsx
components/Comments/CommentRow.tsx
components/Comments/ReplyDialog.tsx
components/ProfileEditPage.tsx
hooks/useNsecLoginPageLogic.ts
app/(drawer)/(tabs)/_layout.tsx
components/NostrActivityItemRow.tsx
components/Comments/ParsedTextRenderer.tsx
hooks/nostrProfile/useNostrProfile.ts
utils/nostr.ts

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Current Korbit Configuration

General Settings
Setting Value
Review Schedule Automatic excluding drafts
Max Issue Count 10
Automatic PR Descriptions
Issue Categories
Category Enabled
Naming
Database Operations
Documentation
Logging
Error Handling
Systems and Environment
Objects and Data Structures
Readability and Maintainability
Asynchronous Processing
Design Patterns
Third-Party Libraries
Performance
Security
Functionality

Feedback and Support

Note

Korbit Pro is free for open source projects 🎉

Looking to add Korbit to your team? Get started with a free 2 week trial here

);
},
enabled: Boolean(followsMap),
staleTime: 24 * 60 * 60 * 1000,
Copy link

Choose a reason for hiding this comment

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

Uniform Cache Staleness Strategy category Performance

Tell me more
What is the issue?

Static staleTime of 24 hours is used across multiple queries without considering different data freshness requirements.

Why this matters

Profile data and follow relationships may need different refresh strategies. A one-size-fits-all staleTime could lead to stale data or unnecessary refetches.

Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.

@joshr4
Copy link
Collaborator Author

joshr4 commented Jan 17, 2025

/korbit-review

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

Review by Korbit AI

Korbit automatically attempts to detect when you fix issues in new commits.
Category Issue Fix Detected
Performance Inefficient Set Creation in Query Function ▹ view
Performance Non-optimized Cache Invalidation Strategy ▹ view
Files scanned
File Path Reviewed
components/LoggedInUserAvatar.tsx
hooks/useAuth.ts
hooks/nostrProfile/useSaveNostrProfile.ts
app/auth/welcome.tsx
components/PulseProfilePage.tsx
components/Comments/CommentRow.tsx
components/Comments/ReplyDialog.tsx
components/ProfileEditPage.tsx
hooks/useNsecLoginPageLogic.ts
components/NostrActivityItemRow.tsx
components/Comments/ParsedTextRenderer.tsx
hooks/nostrProfile/useNostrProfile.ts
utils/nostr.ts

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Current Korbit Configuration

General Settings
Setting Value
Review Schedule Automatic excluding drafts
Max Issue Count 10
Automatic PR Descriptions
Issue Categories
Category Enabled
Naming
Database Operations
Documentation
Logging
Error Handling
Systems and Environment
Objects and Data Structures
Readability and Maintainability
Asynchronous Processing
Design Patterns
Third-Party Libraries
Performance
Security
Functionality

Feedback and Support

Note

Korbit Pro is free for open source projects 🎉

Looking to add Korbit to your team? Get started with a free 2 week trial here


const followPubkeys = Object.keys(followsMap);

const commonRelays = new Set(Object.values(followsMap));
Copy link

Choose a reason for hiding this comment

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

Inefficient Set Creation in Query Function category Performance

Tell me more
What is the issue?

Creating a Set from followsMap values for each query execution is inefficient when the data hasn't changed.

Why this matters

Repeatedly creating new Set objects and processing followsMap values can impact performance when dealing with large datasets.

Chat with Korbit by mentioning @korbit-ai, and give a 👍 or 👎 to help Korbit improve your reviews.

@joshr4
Copy link
Collaborator Author

joshr4 commented Jan 17, 2025

/korbit-review

Copy link

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

I've completed my review and didn't find any issues... but I did find this shark.

                (`.
                 \ `.
                  )  `._..---._
\`.       __...---`         o  )
 \ `._,--'           ,    ___,'
  ) ,-._          \  )   _,-'
 /,'    ``--.._____\/--''
Files scanned
File Path Reviewed
components/LoggedInUserAvatar.tsx
hooks/useAuth.ts
hooks/nostrProfile/useSaveNostrProfile.ts
app/auth/welcome.tsx
components/PulseProfilePage.tsx
components/Comments/CommentRow.tsx
components/Comments/ReplyDialog.tsx
components/ProfileEditPage.tsx
hooks/useNsecLoginPageLogic.ts
components/NostrActivityItemRow.tsx
components/Comments/ParsedTextRenderer.tsx
hooks/nostrProfile/useNostrProfile.ts
utils/nostr.ts

Explore our documentation to understand the languages and file types we support and the files we ignore.

Need a new review? Comment /korbit-review on this PR and I'll review your latest changes.

Korbit Guide: Usage and Customization

Interacting with Korbit

  • You can manually ask Korbit to review your PR using the /korbit-review command in a comment at the root of your PR.
  • You can ask Korbit to generate a new PR description using the /korbit-generate-pr-description command in any comment on your PR.
  • Too many Korbit comments? I can resolve all my comment threads if you use the /korbit-resolve command in any comment on your PR.
  • Chat with Korbit on issues we post by tagging @korbit-ai in your reply.
  • Help train Korbit to improve your reviews by giving a 👍 or 👎 on the comments Korbit posts.

Customizing Korbit

  • Check out our docs on how you can make Korbit work best for you and your team.
  • Customize Korbit for your organization through the Korbit Console.

Current Korbit Configuration

General Settings
Setting Value
Review Schedule Automatic excluding drafts
Max Issue Count 10
Automatic PR Descriptions
Issue Categories
Category Enabled
Naming
Database Operations
Documentation
Logging
Error Handling
Systems and Environment
Objects and Data Structures
Readability and Maintainability
Asynchronous Processing
Design Patterns
Third-Party Libraries
Performance
Security
Functionality

Feedback and Support

Note

Korbit Pro is free for open source projects 🎉

Looking to add Korbit to your team? Get started with a free 2 week trial here

@joshr4 joshr4 merged commit 2608d41 into main Jan 17, 2025
@joshr4 joshr4 deleted the auto-fetch-followers branch January 17, 2025 21:59
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