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

feat(ui): fetch account data on demand #2632

Merged
merged 8 commits into from
Mar 4, 2024

Conversation

userquin
Copy link
Member

@userquin userquin commented Feb 27, 2024

This PR includes:

  • fetch account data when hovering on the account link (on demand)
  • add status card skeleton when resolving the account data

This will also prevent fetching account data of all accounts in the viewport while scrolling.

We can change the skeleton or switch to use an spinner loader.

Check this video https://streamable.com/4kk87e : added few seconds timeout to see the skeleton on first fetch (afterwards it is immediate)

/cc @patak-dev @shuuji3

Copy link

stackblitz bot commented Feb 27, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

netlify bot commented Feb 27, 2024

Deploy Preview for elk-zone ready!

Name Link
🔨 Latest commit 49b7ac0
🔍 Latest deploy log https://app.netlify.com/sites/elk-zone/deploys/65e61ae898e67800081cf713
😎 Deploy Preview https://deploy-preview-2632--elk-zone.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Feb 27, 2024

Deploy Preview for elk-docs canceled.

Name Link
🔨 Latest commit 49b7ac0
🔍 Latest deploy log https://app.netlify.com/sites/elk-docs/deploys/65e61ae898e67800081cf715

@patak-dev
Copy link
Member

Is the skeleton still working for you? I can't see it when I test the preview: https://deploy-preview-2632--elk-zone.netlify.app/

@userquin
Copy link
Member Author

userquin commented Mar 4, 2024

skeleton logic removed, only fetch on hover

@@ -5,7 +5,7 @@ const { account } = defineProps<{
account: mastodon.v1.Account
}>()

const relationship = useRelationship(account)
const relationship = computed(() => account ? useRelationship(account).value : undefined)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should call useRelationship inside a computed. I think you should extract useRelationship to an outside ref. If you don't want that ref (that changes once fetchRelationships() finished), then you could abstract a helper around requestedRelationships

Copy link
Member Author

Choose a reason for hiding this comment

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

done

Copy link
Member Author

@userquin userquin Mar 4, 2024

Choose a reason for hiding this comment

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

too many useRelationship usages to refactor it here: we should debounce the call

@patak-dev patak-dev added this pull request to the merge queue Mar 4, 2024
Merged via the queue into main with commit 308b50c Mar 4, 2024
15 checks passed
@patak-dev patak-dev deleted the userquin/feat-fetch-account-on-demand branch March 4, 2024 19:22
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